distance between android and iphone

烂漫一生 提交于 2019-11-30 15:39:25

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).

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.

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