I need to know the signal strength of a Bluetooth connection to a remote device that I make with my Android 2.1 phone. From the SDK, I can see that I can determine the RSSI at the time I discover the remote device. But I can't see how to update that RSSI value over time.
Can someone give me a hand? Thanks!!
From the SDK it is the only way to obtain RSSI. It is a little bit inconvenient, since it is not useful if you only want to periodically monitor the strength of the signal of a paired device.
However there is a way, but out of SDK. You can use native API (by means of NDK) and call functions provided by Bluez API, the underlying bluetooth framework in Android (and almost any linux system). The function in question is hci_read_rssi()
provided by libbluetooth.so
(part of Bluez stack). In order to learn how to use it, you can take a look at Hcidump tool sources (that comes with Bluez). You could write a JNI wrapper code to your function, so you could get the signal strength of paired device.
There are two drawbacks of using this method:
hci_read_rssi()
. This is slower than just measuring RSSI from beacons, as other wireless communication means provide (GSM or WIFI)