Android: Update Bluetooth Rssi Every Second
I'm trying to display the bluetooth signal strength (rssi) evry second (Timer()) from detected device but i couldn't call onRecive() multiple times because Receiver Lifecycle. I ne
Solution 1:
You can only get the RSSI value during a device discovery scan. (Bluetooth Discovery vs Connection)
"Is it easier if the device is connected?" Accordingly with android docs: "if you already hold a connection with a device, then performing discovery can significantly reduce the bandwidth available for the connection, so you should not perform discovery while connected."
Do you really need to perform an inquiry every 1 second? Will consume a lot of battery...
Since you need to perform the measure periodically, why not use AlarmManager or CountDownTimer?
In your specific case, I believe you should be using AlarmManager, since it can repeat indefinitely. If you want something to execute every second for 10 seconds, for example, use CountDownTimer.
Post a Comment for "Android: Update Bluetooth Rssi Every Second"