1

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.

양한백
  • 11
  • 1
  • 2

1 Answers1

2

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.

Youssif Saeed
  • 11,789
  • 4
  • 44
  • 72
  • thanks a lot for your answer. problem get solved by change the server modul. haha... – 양한백 Apr 19 '19 at 13:17
  • and i tried to use ble and get distance value from rssi value. it seems work. – 양한백 Apr 19 '19 at 13:17
  • RSSI varying per channel (frequency) is an important factor too. This is covered for Advertisements in [Bluetooth-Low-Energy RSSI changes periodically on Android devices](https://stackoverflow.com/questions/33016780/bluetooth-low-energy-rssi-changes-periodically-on-android-devices). – KevinJWalters May 05 '20 at 14:06