简体   繁体   中英

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? Do those other iOS7 devices need to have Bluetooth turned on?

An iOS device with BluetoothLE can act as an iBeacon yes.

Check out the AirLocate example code at https://developer.apple.com/downloads/index.action?name=WWDC%202013#

Being an iBeacon doesn't give feedback about devices that come into range so you'd have to implement that yourself. ie you'd have to have the devices that detect the iBeacon then tell the iBeacon they'd seen it through some other means.

Yes, an iOS device can act as a beacon, from iPhone 4s and up (Bluetooth 4.0 required).

You publish a beacon by passing the dictionary from [CLBeaconRegion peripheralDataWithMeasuredPower:] to [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. You can do exactly what you are suggesting if you have an app installed on all phones, and you also write a web service. This would allow phone A to see phones B and C when they are nearby:

  1. Your app on Phone A acts as an iBeacon advertising its presence.
  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.
  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.

All phones would need Bluetooth LE, have it turned on, and have your app installed. They would also need internet connectivity to call the web service.

If you're not set on using iBeacons, this project uses Bluetooth LE to share an array of ids between nearby phones- 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.

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.

From the Apple documentation :

While your app is in the background, the local name is not advertised and all service UUIDs are placed in the overflow area.

As mentioned, an iOS 7 device can act as an iBeacon, so long as it Bluetooth LE technology.

To use iBeacon, you need iOS 7 or later, Bluetooth turned on, and a compatible iOS device:

  • iPhone 4s or later
  • iPad (3rd generation) or later
  • iPad mini or later
  • iPod touch (5th generation) or later.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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