简体   繁体   English

两部安卓手机之间的距离

[英]Distance between two android phones

I'm wondering: other than GPS location, is there any way to find if two phones is within a certain distance from each other?我想知道:除了 GPS 定位之外,还有什么方法可以找到两部手机是否在一定距离内? For example, if one phone is under 3 feet from another one, as GPS is not that accurate.例如,如果一部手机距离另一部手机不到 3 英尺,那么 GPS 就不是那么准确。

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.我正在为我在 android 平台上的最后一年项目开发一个多人互动游戏,它要求一个玩家与另一个玩家的距离在 3 英尺以内。

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.但到目前为止,使用蓝牙 RSSI 值似乎是可行的方法。

No, Android devices do not contain such features.不,Android 设备不包含此类功能。 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.也就是说,当您感兴趣的 Android 设备彼此相距大约 1 米时,单击一个按钮。

See the following question: Android 2.1: How do I poll the RSSI value of an existing Bluetooth connection?请参阅以下问题: Android 2.1:如何轮询现有蓝牙连接的 RSSI 值?

I also have the same need, and indeed GPS can't be used for such accuracy.我也有同样的需求,实际上 GPS 不能用于这种精度。 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.例如,将两个Android设备放在一起并同时按下一些校准工具。 Then, you will be considering that point in space the (0,0,0) coordinate for both devices.然后,您将考虑空间中的那个点,即两个设备的 (0,0,0) 坐标。

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.要去看看那个蓝牙 RSSI 的东西。

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.如果做不到这一点,振动和加速度计具有相同的原理,但会根据一些已知的基线寻找强度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM