iBeacons and background modes

Hello everyone!


We are developing an app that needs to work in foreground, background and even when the user kills it deliberately. Also, we need to get bluetooth switch events. Entries to and exits from a region and bluetooth switch events fire a communication event with a server that takes no longer than 2 seconds.


Our app acts as a central BLE device and monitors a custom iBeacon region. We want to monitorize an unknown number of regions with the same UUID, so the limitation of 20 iBeacon regions drove us to start monitoring without specifying the minor and major values and to retrieve those values with ranging.


We know that Apple needs proper justifications for using background modes in an app. We do not intend to benefit ourselves with the use of background modes but to ease the user experience and to quick response to BLE detection.


Key points:

  • Running in foreground works perfectly.
  • Ranging in background was not working (that is normal) so we added location background modes (along with allowsBackgroundLocationUpdates set to true) to range beacons continuously.
  • didEnterRegion and didExitRegion worked when app was killed but bluetooth switch events were not received. That is why we added bluetooth-central background modes support.


We noticed that sometimes, didEnterRegion or didExitRegion events were not propertly fired when these two background modes were not added and the app was killed. After adding these two background modes, those events were fired according to specification.


Are we incurring in some Apple guideline violation with the use of these background modes? Would our app be rejected if we use this background modes? User experience is fundamental for us and with these background modes we have acomplished a full user experience.


Thank you very much in advance.

Replies

App Store Review Guidelines (https://developer.apple.com/app-store/review/guidelines/)

2.5.4 Multitasking apps may only use background services for their intended purposes: VoIP, audio playback, location, task completion, local notifications, etc.


Whether your use of the background modes is appropriate or not, is up to App Review to decide, and up to you to defend.


That said, if you are having difficulties detecting your beacons through didEnter/didExit events without the unnecessary background modes, either your implementation is flawed, or the beacons are not to spec. You should make sure that the beacons follow the iBeacon specification fully, and are properly calibrated (with the Measured Power data accurately presented).

Thank you for your response.


We do not think that our implementatino is flawed, the code for monitoring regions is pretty simple and straight forward.


Maybe our iBeacons do not fully conform to specs, we will check that and ask again if the problem persists.


Thank you again.

Just curious if you got this working reliably? We have an app that needs to wake up when our iBeacons come into range and we’ve been noticing lately that while most users experience no issues, some users experience frequent failures where our app simply does not wake up even when the iBeacons repeatedly get brought into / out of range.

it’s like iOS on their phone has decided our app is no longer going to be woken up until they bring the app into the foreground. Then everything works fine again for a few days - until it stops again.

we just cannot figure out why most users have no issues while some have frequent issues. Why would iOS not launch our app in the background when a monitored beacon comes into range? When they get in this state we can bring the beacon in / out of range 10 times and nothing happens. But for days prior, even with the app killed by the user, it works fine.

Have you resolved?