distance between android and iphone

巧了我就是萌 提交于 2019-11-29 22:32:36

问题


I am looking for a way to transmit data when two phones are close by. This needs to be cross platform so I cannot use NFC or iBeacon. I plan on using allJoyn to send information. I would only like to send data to others that are within a few feet of me.

Is there any way that I could get an accurate reading of distance on other phones? Or can I get an accurate distance on a master device that could be placed in the room?


回答1:


Shot in the dark answer:

  1. If both devices are on the same wireless WiFi network (same subnet), then any devices on same network are "close enough".

  2. When on the celluar network (or when only one device is on Wifi), use the Location APIs of the platform to get GPS coordinates. Send your coordinates up to a web server that keeps track of the Latitude/Longitude coordinates of each device. The web service also allows the devices to poll for nearby devices (where the distance equation can be computed on the server).




回答2:


So the best way that I found to do this is to use the accelerometer to tell when two devices bump then I get the bluetooth signal strength of the nearest device, if that falls into a certain value then they are touching.



来源:https://stackoverflow.com/questions/20730115/distance-between-android-and-iphone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!