Can you please explain me the actual flow for did enter in a beacon’s region of receiving local notification? I receive them with a considerable delay, and I wish I receive the notification instantly when I enter in a beacon’s region. Is there any solution or any explanation?
Thank you
It goes more or less like this:
- The user opens your app.
- You
startMonitoring
, which makes iOS note down that your app wants to be notified when the phone enters or exits range of a beacon that matches yourCLBeaconRegion
. - The user then leaves your app or locks their phone.
- iOS puts your app to sleep. The app can’t execute any code at this time.
- Sometime later, when iOS detects the phone entered/exited range of a beacon, it’ll check what apps wanted to be notified of this event.
- iOS wakes up your app from sleep (or re-launches it from scratch, if the app got killed in the meantime).
- iOS delivers the didEnter/didExit event to your app.
- In your app’s didEnter handler, there’s code that tells iOS to immediately show a local notification.
- iOS shows the notification.
The delay usually happens in step 5, i.e., iOS detecting when you enter the range of the beacon.
If you have Location Beacons, you could try Estimote Monitoring, which is our attempt to make the beacon enter/exit detection more responsive and reliable:
Unfortunately, I have Proximity Beacons. Is there any solution for those ones?
Nothing that I know of, sadly You could open an “improvement request” on the Apple bug tracker, help us spread awareness about this problem with the Apple engineers: https://bugreport.apple.com/
We eventually hope to bring Estimote Monitoring to Proximity Beacons too, we’ve just decided to start small and focus really hard on a single hardware model to begin with.