Registering a BroadcastReceiver for the action BluetoothDevice.ACTION_ACL_DISCONNECTED
works.
Disconnect Callback in Motorola's ICS Bluetooth Low Energy API
-
28-11-2021 - |
题
I'm using Motorola's "Bluetooth Low Energy ICS_R2 API". So far, I was able to connect to a TI 2540 keyfob and to write characteristics. What I need in addition is a callback or intent that is triggered when the keyfob gets out of range. My current solution is a watchdog that periodically starts a characteristics discovery. If the characteristics discovery fails, the watchdog considers the keyfob lost. However, I think this drains the keyfob's battery too fast. Is anyone aware of a better solution?
UPDATE
The actions in com.motorola.bluetoothle.BluetoothGatt seemed interesting. However, I guess that these are just relics of the old Motorola BLE API.
It seems that BluetoothDevice.ACTION_ACL_DISCONNECTED works for low energy devices, as well.
解决方案