Every phone has only 1 bluetooth device, but there might be several applications that want to transmit ibeacon signals. Which signal will be transmitting? The application that was launched later?
2 Answers
The application on the foreground.
From Apple docs:
Any iOS device that supports sharing data using Bluetooth low energy can be used as an iBeacon. Because the app you write must run in the foreground, iBeacon support on iOS devices is intended for testing purposes and for apps that always run in the foreground anyway, such as point-of sale apps. For other types of iBeacon implementations, you need to acquire dedicated beacon hardware from third-party manufacturers.

- 13,044
- 6
- 50
- 73
It seems that I have found the answer.
The Apple tutorial here (https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/CBPeripheralManager_Class/Reference/CBPeripheralManager.html) says that
"Data advertising is done on a “best effort” basis, because space is limited and there may be multiple apps advertising simultaneously."

- 2,655
- 1
- 17
- 9
-
1This does not apply to iBeacons because any best effort background advertisement will not conform to the iBeacon advertising spec. Only a foreground app can advertise as an iBeacon as @erkanyildiz says. – davidgyoung Jun 01 '14 at 13:32
-
Where is it written? What specification will it conform? In my app I need just an UUID, major and minor, can I advertise them in the background? – Sergey Demyanov Jun 02 '14 at 06:35
-
1No. Advertisement is limited in the background so that only the presence of an iOS device is detectable for non-iOS devices while the app is backgrounded. The advertised services will be discoverable only by other iOS devices, and even those have to run the scanning app in the foreground. – allprog Jun 02 '14 at 08:06
-
1See this answer for a description of how background advertising works on iOS: http://stackoverflow.com/a/20460113/1461050. Note that the advertisement data are all stripped away in the background, which makes an iBeacon advertisement useless because you cannot connect to the device to read its identifiers. (iBeacons are connectionless.) – davidgyoung Jun 02 '14 at 11:04
-
@davidgyoung I know there were some changes in how iOS 7.1 operates with ibeacons. Did this behavior remain the same, do you know maybe? – Sergey Demyanov Jun 02 '14 at 13:43
-
1I do not believe there are any changes with respect to background advertisements. As soon as a transmitter app in iOS is put into the background, iOS receivers cannot detect the iBeacon. You can test this yourself on iOS7.1 if you have two iOS devices running my Locate for iBeacon app. If you do not have two iOS devices, you can use ScanBeacon for Mac as the iBeacon detector (if you have a Mac) or iBeacon Locate for Android (if you have an Android device.) – davidgyoung Jun 02 '14 at 13:55
-
@allprog - you are mistaken in claiming that only other iOS devices will be able to discover the device; rather, it's nearly the opposite, as it is iOS devices which have software restrictions on passing the full received packet to an application, something **other platforms do not suffer from**. It's the fact that nobody else imposes these restrictions which makes their presence in iOS rather pointless. – Chris Stratton Jun 02 '14 at 14:10
-
@ChrisStratton according to the answer, Sergey is planning to use an iOS device as iBeacon. Now, if I'm not mistaken, I wrote my comment regarding iOS devices being the peripheral. iOS will remove the services from the advertisement and place it in the non-advertised "overflow area" so other devices will not be able to read those. But an iOS central with foregrounded app will request the peripheral for the "overflow area" to get this info. I apologize if my English is not perfect, this is what I meant. – allprog Jun 02 '14 at 15:55
-
Your absolute mistake is in thinking that an iDevice can read something that non-iDevices cannot. **That's simply not true**. The additional service characteristics not present in the advertising packet, which a central must query for, are a **standard** part of BLE. Where BLE is concerned, iOS is **more limited** (not more capable) than other implementations. – Chris Stratton Jun 02 '14 at 15:57
-
@ChrisStratton you may be right. I haven't had the opportunity to try out other devices yet and what I described has been discussed on the Apple bluetooth-dev list since forever. I'm sorry if I'm mistaken, my bad. I would highly appreciate if you could send some references to what you are describing. Some demo or case study would be best. (On the side, I'd suggest you rather try to explain why something is bad calmly instead of outright attacking people who try their best to help. StackOverflow is about friendship, isn't it? Peace! :) ) – allprog Jun 02 '14 at 17:03