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));}