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.

有帮助吗?

解决方案

Registering a BroadcastReceiver for the action BluetoothDevice.ACTION_ACL_DISCONNECTED works.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top