Target is not to have the real distance. It is something simpler.
Target is to check whether another device is very very close. True or false. Let's say 10 or 15 cms is close so our check is true and any device further away fails the check and it is false.
My first approach was to use api's method fetchUuidsWithSdp()
but it failed!
Latency seemed the same whether the devices where a couple of cms away or at the other end of a large room!
Any solution even without bluetooth is acceptable. For instance, I am totally unfamiliar with the wifi direct p2p protocol. Maybe there could be something in there useful to have a rough estimation of distance.
Edit: I am reading about Received Signal Strength Indicator(RSSI). This could be used for our particular case, a rough estimation of distance between devices. But maybe there could be something to combine in order to improve the accuracy.
Edit: I put Ralgha's answer to the test. I did established a connection and had a minor protocol to ping-pong among devices.
When ping-ponged with 1 byte average latency was 22.6000 msec when very close and 22.6087 msec when on the other corner of the room.
When ping-ponged with 1024 bytes average latency was 40.3173 msec when very close and even smaller, 32.3138 msec, when on the other corner of the room.
After all, indeed, latency does not carry any information about distance!
Thanks!
You can measure distance with sound.