bluetooth – Distance between two android phones-ThrowExceptions

Exception or error:

I’m wondering: other than GPS location, is there any way to find if two phones is within a certain distance from each other? For example, if one phone is under 3 feet from another one, as GPS is not that accurate.

I’m developing a multiplayer interactive game for my final year project on the android platform and it would require that one gamer is within 3 feet or less from another.

Anything at all is most helpful but from looking around it would seem that it’s not really possible. Most phone data can be shared and I will be using both bluetooth and multicast sockets.

Thanks very much for your time.

Thanks to everyone so far for your replies. I’m still looking into this and will update when I find something alittle bit easier to do; but so far it would seem using bluetooth RSSI value is the way to go.

How to solve:

No, Android devices do not contain such features. The best thing you can probably do is to measure bluetooth signal strength. It will not automatically give you a precise answer, but you could perhaps create a baseline in your application first. That is, click a button when the Android devices you are interested in are roughly 1 metre from each other.

See the following question: Android 2.1: How do I poll the RSSI value of an existing Bluetooth connection?


I also have the same need, and indeed GPS can’t be used for such accuracy. My solution is more practical and envolves way less calculation. At the moment of the beginning of the game, you might “calibrate” the devices you want to interact with.

For instance, bring the two android devices together and press some calibration tool at the same time. Then, you will be considering that point in space the (0,0,0) coordinate for both devices.

Using Accelerometer and Gyroscope, basically, and maybe other sensors, you can do the trick. Hope it helps, cause it is the solution I’m about to implement right now. Gonna take a peek at that bluetooth RSSI stuff.


Could you not have one device play some audio then the other calculate the delay in hearing that audio? Failing that, Vibration and Accelerometer with the same sort of principle but look for strength, based upon some known baselines.

Leave a Reply

Your email address will not be published. Required fields are marked *