It is possible to add location awareness to an application when it’s closed?
For example I’d like to create a proximity service that works when my application is closed and pushes a local notification to the user when he reaches an area.
I read that with CLRegion I can achieve a similar result but only whenever the application is active (or in background).
I need something similar to a remote notification service activated by the user location. But it sounds really strange. Is it possible to have a similar service in iOS?
There are 2 options:
One is the significant location changes service which John mentioned above.
The other one is the
startRegionMonitoringBoth are covered in the Location Awarness Documentation From Apple
Both can open an terminated (closed) app for a brief moment and you can deliver a local push notification to alert the user.
The app cannot get in a normal state, but if the user clicks the notification the app will open, so you can achieve your goal.
Here is a sample code on intercepting the event in the didFinishLaunchingWithOptions delegate and firing a local notification.
Normally you should not fire the notification here, but rather reinitialize your location manager, get the new position and display the message (local notification) for the area the user did enter…