How to Start an Ibeacon Transmitter in the Background

Can we start an iBeacon transmitter in the background?

Unfortunately, no. iOS does allow background advertising of Bluetooth Services, but only using a proprietary technique that breaks the iBeacon advertising format. As a result, if your app starts transmitting as an iBeacon, then switches to the background, its transmission will still exist, but it will no longer be picked up by iBeacon detectors. See here for more information:

...you should be aware that advertising while your app is in the background operates differently than when your app is in the foreground. In particular, when your app is advertising while in the background ...[a]ll service UUIDs contained in the value of the CBAdvertisementDataServiceUUIDsKey advertisement key are placed in a special “overflow” area; they can be discovered only by an iOS device that is explicitly scanning for them.

The bottom line is that iOS devices cannot transmit as iBeacons when they are in the background.

Edit 4/11/2020: Apple announced plans for a new beacon advertisement that will work in the background. See here for more info.

iOS - iBeacon - Advertise (Broadcast) as beacon in Background after iOS 7.1 update

Unfortunately, it is simply not possible to advertise as an iBeacon in the background on iOS. For an explanation as to why, see here: Can we start iBeacon transmitter in background?

Need help in integrating iBeacon + BLE Peripheral Scanning iOS Background mode feature

iOS will launch your app upon beacon detection and you will get a didEnter(region:) callback. At this time, you can immediately start beacon ranging with locationManager.startRangingBeacons(...) and you will get didRangeBeacons(...)callbacks for a few seconds -- long enough to read the major/minor identifiers and do the work you need.

iBeacon monitoring and ranging in background

The problem you describe is common. Other than extending background ranging time (which you have already done), there is no magic bullet on iOS.

Two additional techniques may help. Both of these techniques involve getting a new entry event as you pass from one beacon to the next:

  1. Get hardware beacons that allow you to tune down the transmitter power (my company's RadBeacon products allow this) so the transmissions do not overlap. This way you get an exit event then a new enter event as you move from beacon to beacon.

  2. Redesign your identifier schene so the major field is dedicated to identifying up to 20 different regions (based on UUID and major 1-20). You then monitor for all of these regions. Your individual beacons can still use the minor however you want and specifically as the key to trigger messaging. When placing your beacons, you make sure that none with overlapping transmissions share the same major. This will ensure a new background entry event as you move from one to the other.



Related Topics



Leave a reply



Submit