简体   繁体   English

检查带有特定应用的iDevice是否在附近

[英]Check if iDevice with a specific app is nearby

Is it possible to check within an app, if there are other idevices nearby which have the app running? 是否可以在应用程序内检查附近是否有其他正在运行该应用程序的idevice?

For example device A starts the app. 例如,设备A启动该应用程序。 Device B also starts the app. 设备B也会启动该应用程序。 When they are nearby, a notification will popup. 当他们在附近时,会弹出通知。

I know its possible to check the range between two GPS coordinates. 我知道可以检查两个GPS坐标之间的距离。 But the only solution that I've found on the internet was, that I have to make a webservice/server which handles the coordinates which were sent by the idevices. 但是,我在互联网上找到的唯一解决方案是,我必须制作一个Web服务/服务器来处理由idevices发送的坐标。

But I'd like to make it run "offline", without saving/sending the data at a webserver. 但是我想使其“脱机”运行,而不在网络服务器上保存/发送数据。

You can achieve exactly this using the new iBeacons functionality in iOS 7. I'm not sure I can link to the exact documentation due to the NDA currently (although the feature was mentioned publicly at WWDC), but if you search for 'beacons' on the Apple Developer site you should find what you need. 您可以使用iOS 7中的新iBeacons功能来实现此目的。由于NDA当前(尽管该功能已在WWDC上公开提及),我不确定我是否可以链接到确切的文档,但是如果您搜索“ beacons”,在Apple Developer网站上,您应该找到所需的内容。

There are also some examples towards the end of this year's WWDC session 307 - "What's new in Core Location?". 在今年的WWDC会议307即将结束时,也有一些示例-“核心位置有什么新功能?”。 This is arguably more useful than the documentation. 可以说这比文档有用。

Essentially, you define a beacon region and tell your devices to start advertising their presence. 本质上,您定义了一个信标区域,并告诉您的设备开始宣传它们的存在。 At the same time, you can listen out for beacons in the local area - CoreLocation will then report you the identifier and approximate distance of each device. 同时,您可以在本地侦听信标-CoreLocation将随后向您报告每个设备的标识符和大概距离。

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

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