1
votes

I have a module device (Galaxy S2, API 16) and this device is use to be server module.

and I need a distance of between server device and client device.

TRY 1. I tried use RSSI value to get distance. (use BroadCastReceiver, android.bluetooth.device.action.found and EXTRA_RSSI)

but it works only for unpaired devices, and need allow always bluetooth search mode.

i think my client doesn't like it that i can't use that.

TRY 2. I tried use BluetoothGattServer - readRemoteRSSI().

but gatt server required API 18, my server module is 16. I couldn't use that.

TRY 3. I connected server and client (Classic Bluetooth) for data communication.

I think some data packet will be loss by distance. (and i guessed data loss = distance)

but, RFCOMM was perfect. data is completely receive and send in bluetooth range.

i think that reason is RFCOMM similar to TCP PROTOCOL. (just in my guess)

and then i tried use to L2CAP protocol. (cause is similar to UDP. and i guessed it will be make a packet loss.)

but, android doesn't supply L2CAP protocol.

what can i do for get distance?

p.s) sorry for my english. thanks to read.

1

1 Answers

2
votes

Bluetooth is not an ideal wireless technology for getting the distance. Version 5.1 introduced Angle of Arrival (AoA) and Angle of Departure (AoD) features in order to get better location capabilities, but any version before that (including 4.0 which the version of Bluetooth for the Galaxy S2) will only give you an approximate (near or far), and it is relatively inaccurate. Please see similar questions/answers here:-

I hope this helps.