for a PoC I have to test the following requirement. The client wants to send out remote notifications, which hold data for geofences within the notification. I do not mean "normal" notifcations, instead I mean "silent" notifications. The user will not notice that he received a notification. Only the app receives data from this notification.
So far so good: I have completed a test app, which does exactly what the client wants, i.e.
- I have a working app, which sets up some geofences during app start.
- Those fences work perfectly, all required background permissions are set correct.
- I can receive (silent) remote notifications and parse the containing geofence data, and setup those regions for monitoring too.
After a couple of tests in iOS 11 I experienced the following:
- When the app is in foreground/active, while receiving the (silent) remote notification, everything works fine: As soon as I receive a remote notification, it gets processed correctly, and the geofences trigger correctly their didEnter/didExit actions.
- When I start this exact same test, but this time with the app in background while receiving the (silent) remote notification, the geofences do not work. From what I see from my logs, everything is processed in the exact same way, like when the app would run in active state. Except the didEnter/didExit actions are never triggered...
I googled a lot yesterday, but I did not find an explanation for this behavior. My assumption is, that the locationManager somehow acts different, when it comes to setup a region to monitor, while the app is in background-state.
So I wonder if anyone else tried to archieve a similiar geofence scenario, and could me explain why.
thx in advance!