我正在使用運行jb的根三星galaxy nexus手機,由於某些原因,我沒有收到來自藍牙連接服務的任何廣播意圖。下面你會發現我的接收器清單和廣播接收器代碼。任何提示或想法,將不勝感激。Android JB廣播接收器沒有收到bluetooth.android.bluetooth.BluetoothDevice.ACTION_ACL_CONNECTED
感謝
這裏是清單
<receiver android:name=".ABroadcastReciever" >
<intent-filter>
<action android:name="android.bluetooth.BluetoothDevice.ACTION_ACL_CONNECTED" />
<action android:name="android.bluetooth.BluetoothDevice.ACTION_ACL_DISCONNECTED" />
<action android:name="android.bluetooth.BluetoothDevice.ACTION_BOND_STATE_CHANGED" />
<action android:name="android.bluetooth.BluetoothDevice.ACTION_FOUND" />
<action android:name="android.bluetooth.BluetoothDevice.BOND_BONDING" />
<action android:name="android.bluetooth.BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED" />
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
</receiver>
這裏是Reciever
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
//This is looking for the Wifi Connectivity Changes
if(action.equals("android.net.conn.CONNECTIVITY_CHANGE")){
Log.d(TAG,"received: Wifi Connection Change");
}
//This is looking Bluetooth connection disconnect
else if(action.equals("android.bluetooth.BluetoothDevice.ACTION_ACL_DISCONNECTED") ||
action.equals("android.bluetooth.BluetoothDevice.ACTION_ACL_DISCONNECTED_REQUESTED")){
Log.d(TAG,"Received: Bluetooth Disconnected");
}
//This is looking for Bluetooth connection established
else if(action.equals("android.bluetooth.BluetoothDevice.ACTION_ACL_CONNECTED")){
Log.d(TAG,"Received: Bluetooth Connected");
}
}
您是否在JB之前嘗試過相同的應用程序?換句話說,JB是問題還是上述代碼? – Tom