0

With a Bluetooth application in android, I would need to calculate with accuracy the distance between two devices. From my research, I need two parameters, RSSI and TX Power

Through the discovery of the devices can read RSSI, eg:

BluetoothDevice bluetoothDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
int rssi = intent.getShortExtra(BluetoothDevice.EXTRA_RSSI,Short.MIN_VALUE);

while I can not find a way to read the tx power of a Bluetooth device via the Android API.

Can anyone help me to get the Tx power or any other solution to calculate the distance between devices?

 double getDistance(int rssi, int txPower) {
        return Math.pow(10d, ((double) txPower - rssi) / (10 * 2));}
ukBaz
  • 4,895
  • 2
  • 7
  • 23
  • The device needs to include the txPower value in it's advertisement package like Bluetooth beacons (such as iBeacons) do. Related: [https://stackoverflow.com/questions/36862185/what-exactly-is-txpower-for-bluetooth-le-and-how-is-it-used#answer-36867888](https://stackoverflow.com/questions/36862185/what-exactly-is-txpower-for-bluetooth-le-and-how-is-it-used#answer-36867888) – Markus Kauppinen Sep 15 '21 at 12:48

0 Answers0