iBeacon in the background - Use cases
Asked Answered
R

1

33

The number of questions on SO related to iBeacon and its background capabilities is increasing and there is some confusion on that point. I have been testing the AirLocate project.

iBeacon has 2 "capabilities": Region monitoring and Ranging.

Region monitoring is limited to 20 regions and can function in the background (of the listening device) and has different delegates to notify listening app (and user) of entry/exit in the region - even if app is in the background or phone is locked.

Ranging works only in the foreground but will return (to the listening device) an array (unlimited?) of all iBeacons found along with their properties (UUID, etc..)

In addition, that 20 regions monitoring is a device limit. If the user is using geofencing reminders, other apps that use region monitoring; this will lower that number.

  1. So are we saying that I can not deploy a mall-wide (100 stores+) app that uses store iBeacons to send a "store specific" notification to the user, while the app is in the background or the phone is locked?

  2. I gather that the advertising device (the beacon) has to be in the foreground as well to advertise a region that the listening device could "enter" into. So are we saying, that if the owner of a store had an iOS device; I could not for example save him money by asking him to use his iPhone (at least early on) as an advertising device (beacon) - since the app will likely not always be in the foreground?

  3. So in the case of iBeacon + MLB, a single UUID (or <20 UUIDs) is/are used for the app to possibly determine entry door and, then will the user be required to unlock the phone/bring the app to the foreground to use it (find seat, etc..)?

Can I then call the iBeacon: a single location/event (store, park, etc..) feature that requires the user's most "foreground" attention to have a "complete" practical use case?

I have tried to be articulate about the user cases to bring it to practical. Please reply with more than yes or no.

Radiolucent answered 20/10, 2013 at 11:56 Comment(2)
Are we sure that the "In addition, that 20 regions monitoring is a device limit. " this is a device limit ?? I think this is per app.Rosannrosanna
Is it a device limit or a per-app limit?Leonidaleonidas
A
26

Sounds like you are on the right track. In general you are correct that an app needs to be in the foreground to fully use iBeacon capabilities. A few specifics on your three main questions:

  1. Your mall use case can work with a couple of limitations. (a) you have to conserve your CLBeaconRegions by having many or all 100 stores share the same UUID and/or major number, differing only in the minor number. This allows you to set up a single CLBeaconRegion to monitor many. (b) If the app wakes up into the background from seeing iBeacon 1, it won't be able to wake up a second time from seeing iBeacon 2 in the same CLBeaconRegion unless it first stops seeing any other beacon in that CLBeaconRegion. (You can game this a bit by setting up several CLBeaconRegions and trying group stores so adjacent ones in the overlapping 50 meter bluetooth radio range are in different CLBeaconRegions.)

  2. No, a store owner cannot use their iPad act as an iBeacon in the background -- it has to be in the foreground to work. But they can have their Windows or Mac computer do this using a virtual iBeacon program. My company offers one for free download: http://developer.radiusnetworks.com/ibeacon/

  3. In the door entry use case, yes, the user would have to acknowledge the notification on the lock screen to bring the app into the foreground. A typical implementation would use a single CLBeaconRegion (probably with all iBeacons sharing a ProximityUUID and maybe even a major) to alert the user.

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

Augie answered 21/10, 2013 at 1:47 Comment(8)
Tx for detailed A.On #1 workaround:setup clusters of 10 stores w/ each store in that cluster sharing the cluster's unique UUID+Major but w/each store in that cluster having a different minor. Then when app enters one of the CLBeaconRegions,it recognizes the cluster it has entered (using the CLRegion identifier) and the app can then do ranging to determine the minors available within that cluster. The ranging though still cannot happen in the background and the app does not know which store in that cluster the user is passing (strongest signal etc..) until app is brought to foreground.Correct?Radiolucent
Actually you can range in the background, but only very briefly. When iOS wakes up your app into the background on entering/exiting a CLBeaconRegion, it will run for about 5 secs before being suspended. You can do ranging during this time, then use the results to refine the notification you send to the user.Augie
@Augie just came across your useful blog post, thank you for that! Was wondering if you were able to get enter/exit when the app is not running at all (i.e. killed)Fallfish
No, you can't do that. See my answer here: #21125028Augie
Check on the update on that answer by @Augie It's now possible on iOS7.1 Recommended read: beekn.net/2014/03/…Replication
FYI Background mode behavior has changed in iOS7.1Ably
@Ege Akpinar Yes you can i did a similar project and ran location services in the background even if the app was closed because this is an ios thing not the app itself. And even when the app was terminated it used to call didEnterRegion and didExitRegion methods. I used to send notifications when the app enters a region and exits a region and it was working perfectly even when the app was terminated. But didRangeForBeacons method works only when the app is in the foreground or for a few seconds after it goes to the background then it stops.Breughel
@KeghamK. thanks, it was not possible at iOS 7 back in 2014. CheersFallfish

© 2022 - 2024 — McMap. All rights reserved.