Hi there!
I would be really happy if my application could detect beacons in background mode. And not only get notified when they are around but I would like to know when they are in a specific proximity. I know about some possible solutions, but none of them meets all my requirements. I would love if some of Estimote experts in this forum showed me if I get something wrong
SOLUTION 1. Region monitoring.
This is nice, clean and works in background perfectly. However, it doesnāt take proximity into account. If I want to get notified in background that Iām very close to the beacon, I canāt do that, because I get notified about this beacon once I enter its region and it can be far away. And as I get closer and closer, I wonāt get any new background notifications.
SOLUTION 2. Region monitoring + setting different power levels for every beacon.
This would solve my problems but in my application it would be extremely cumbersome to set power level for every beacon separately. Thats why I rule out this option.
SOLUTION 3. Ranging
Ranging is proximity-aware. But it doesnt work in background I know I know, battery life.
SOLUTION 4. Ranging + Location enabled
It turns out (I know it from this forum btw, thanks!) that ranging actually does work in background. If we turn on Location updates in CLocationManager, and start ranging, then didRangeBeacons delegate method will be called everytime the didUpdateLocations method gets called. It really worked for me, but there are some drawbacks of this solution:
- Sometimes, when my application goes to background, didUpdateLocation doesnāt get called at all. Therefore, didRangeBeacons is not called too. Do you know why this happens?
- This behaviour is clearly not what Apple intended, so I cannot be sure if this option wonāt be removed in the future versions of iOS.
- I havenāt tried to pass this solution through review (mainly beacause of 1. limitation) but I suppose it could be really hard to.
SOLUTION 5. CoreBluetooth Based Scanning: startEstimoteBeaconsDiscoveryForRegion
I was very hopeful about this one. I read that it works in background (we must turn on bluetooth-central background mode ofc) but unfortunately, it didnāt work well for me:
- Most of the time, it worked in background only about 10 seconds and then stopped.
- This method detected 1 out of 3 beacons nearby.
Actually, results of didDiscoverBeacons delegate method were pretty strange and unpredictable, so I assumed I shouldnāt use it too.
Summary
None of the solutions is 100% OK. I wonder if there is some other option or maybe I miss something in above mentioned options. I would really love to get it work!
Iām waiting for your insights guys!