两部安卓手机之间的距离
我想知道:除了GPS定位之外,还有什么方法可以确定两部手机之间的距离是否在一定范围内?例如,如果一部手机与另一部手机之间的距离不足 3 英尺,因为 GPS 不太准确。
我正在为我的最后一年项目在 Android 平台上开发一款多人互动游戏,它要求一个玩家与另一个玩家的距离在 3 英尺或更短的范围内。
任何事情都是最有帮助的,但环顾四周,似乎这实际上是不可能的。大多数电话数据都可以共享,我将使用蓝牙和多播套接字。
非常感谢您抽出时间。
感谢到目前为止大家的回复。我仍在研究这个问题,当我发现一些更容易做的事情时我会更新;但到目前为止,使用蓝牙 RSSI 值似乎是可行的方法。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不,Android 设备不包含此类功能。您可以做的最好的事情可能就是测量蓝牙信号强度。它不会自动为您提供精确的答案,但您也许可以首先在应用程序中创建一个基线。也就是说,当您感兴趣的 Android 设备彼此相距大约 1 米时,单击按钮。
请参阅以下问题:Android 2.1:如何轮询现有蓝牙连接的 RSSI 值?
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?
我也有同样的需求,确实GPS无法达到这样的精度。我的解决方案更实用,并且涉及更少的计算。在游戏开始的那一刻,你可能会“校准”你想要交互的设备。
例如,将两个 Android 设备放在一起并同时按下某个校准工具。然后,您将考虑两个设备的空间中的 (0,0,0) 坐标。
基本上,使用加速度计和陀螺仪,也许还有其他传感器,你就可以做到这一点。希望它有帮助,因为这是我现在要实施的解决方案。我要看看蓝牙 RSSI 的东西。
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.