我希望收到一个事件,用于检测蓝牙在我的设备中何时配对或取消配对。
http://android-er.blogspot.co.il/2014/12/make-bluetooth-connection-between.html这非常有用,但是,它并没有检测到何时建立新连接。
毋庸置疑,我对蓝牙实施毫无用处,我非常清楚:
final BluetoothAdapter.LeScanCallback bleScanCallback = new BluetoothAdapter.LeScanCallback() {
@Override
public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { ... }
}
非常感谢任何帮助。
我想我应该找到一种方法来访问其中一个类:
BluetoothBondStateMachine,BTConnectionReceiver,BluetoothBondStateMachine
这将是一个不错的开始,因为我可以看到在logcat中创建配对/取消配对时,这些类会检测到它。连接到ble设备" shine" :
07-28 18:05:49.284 8332-8332/? I/BTConnectionReceiver﹕ onReceive(context, Intent { act=android.bluetooth.device.action.ACL_CONNECTED flg=0x4000010 cmp=com.google.android.googlequicksearch