简体   繁体   English

iOS7设备可以充当iBeacon吗?

[英]Can an iOS7 device act as an iBeacon?

Can an iOS7 device act as an iBeacon and figure out when other iOS7 devices come in its range? iOS7设备是否可以充当iBeacon,并了解其他iOS7设备何时进入其范围? Do those other iOS7 devices need to have Bluetooth turned on? 那些其他iOS7设备是否需要打开蓝牙?

An iOS device with BluetoothLE can act as an iBeacon yes. 具有BluetoothLE的iOS设备可以充当iBeacon是的。

Check out the AirLocate example code at https://developer.apple.com/downloads/index.action?name=WWDC%202013# 查看https://developer.apple.com/downloads/index.action?name=WWDC%202013#上的AirLocate示例代码

Being an iBeacon doesn't give feedback about devices that come into range so you'd have to implement that yourself. 作为iBeacon并不会提供有关进入范围的设备的反馈,因此您必须自己实施。 ie you'd have to have the devices that detect the iBeacon then tell the iBeacon they'd seen it through some other means. 即你必须拥有检测iBeacon的设备然后告诉iBeacon他们通过其他方式看到它。

Yes, an iOS device can act as a beacon, from iPhone 4s and up (Bluetooth 4.0 required). 是的,从iPhone 4s开始,iOS设备可以充当灯塔(需要蓝牙4.0)。

You publish a beacon by passing the dictionary from [CLBeaconRegion peripheralDataWithMeasuredPower:] to [CBPeripheralManager startAdvertising:] . 您通过将字典从[CLBeaconRegion peripheralDataWithMeasuredPower:]传递到[CBPeripheralManager startAdvertising:]来发布信标。

Publishing a beacon will not give you any feedback on devices, you'll have to scan for others publishing a beacon. 发布信标不会向您提供有关设备的任何反馈,您必须扫描其他人发布信标。

As for backgrounding, you can not publish a beacon in the background, your app needs to be running in the foreground for that. 至于背景,你不能在后台发布信标,你的应用程序需要在前台运行。 Scanning is possible in the background. 可以在后台扫描。

Yes, an iOS7 device can act as an iBeacon. 是的,iOS7设备可以充当iBeacon。 You can do exactly what you are suggesting if you have an app installed on all phones, and you also write a web service. 如果您在所有手机上安装了应用程序,并且还编写了Web服务,则可以完全按照建议执行操作。 This would allow phone A to see phones B and C when they are nearby: 这样手机A就可以在附近看到手机B和C:

  1. Your app on Phone A acts as an iBeacon advertising its presence. 您在电话A上的应用程序充当iBeacon广告其存在。
  2. Phones B and C see this iBeacon, waking up your app to make a call to your web service reporting that they both see Phone A's transmission. 电话B和C看到这个iBeacon,唤醒你的应用程序打电话给你的网络服务报告他们都看到了电话A的传输。
  3. Your app on Phone A queries this web service, which returns a list of phones that see Phone A. In this example, the list includes Phones B and C. Your app updates its display with this list. 您在电话A上的应用程序查询此Web服务,该服务返回看到电话A的电话列表。在此示例中,列表包括电话B和C.您的应用程序使用此列表更新其显示。

All phones would need Bluetooth LE, have it turned on, and have your app installed. 所有手机都需要蓝牙LE,打开它,并安装你的应用程序。 They would also need internet connectivity to call the web service. 他们还需要互联网连接才能调用Web服务。

If you're not set on using iBeacons, this project uses Bluetooth LE to share an array of ids between nearby phones- SimpleShare 如果你没有开始使用iBeacons,这个项目使用蓝牙LE在附近的手机之间共享一系列ID - SimpleShare

You could set an ID for the user of each phone, share them between the phones over Bluetooth LE using the SimpleShare project (even while in background mode), and then query a web service to find out more information about the user with that ID. 您可以为每部手机的用户设置ID,使用SimpleShare项目通过Bluetooth LE在手机之间共享(即使在后台模式下),然后查询Web服务以查找有关具有该ID的用户的更多信息。

One point that didn't come out clearly from the previous answers is that in order for the publishing to work (for example in David's answer's Phone A) the application that started publishing must be in foreground. 之前的答案中没有明确表达的一点是,为了使发布工作(例如在David的答案的电话A中),开始发布的应用程序必须在前台。

From the Apple documentation : 从Apple 文档

While your app is in the background, the local name is not advertised and all service UUIDs are placed in the overflow area. 当您的应用程序在后台时,不会公布本地名称,并且所有服务UUID都会放在溢出区域中。

As mentioned, an iOS 7 device can act as an iBeacon, so long as it Bluetooth LE technology. 如上所述,iOS 7设备可以充当iBeacon,只要它是蓝牙LE技术。

To use iBeacon, you need iOS 7 or later, Bluetooth turned on, and a compatible iOS device: 要使用iBeacon,您需要iOS 7或更高版本,打开蓝牙以及兼容的iOS设备:

  • iPhone 4s or later iPhone 4s或更高版本
  • iPad (3rd generation) or later iPad(第3代)或更高版本
  • iPad mini or later iPad mini或更高版本
  • iPod touch (5th generation) or later. iPod touch(第5代)或更高版本。

http://support.apple.com/kb/HT6048 http://support.apple.com/kb/HT6048

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

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