iOS Question How to detect if app was swipe-killed? (in context of geofences)

Sandman

Expert
Licensed User
I'm experimenting a bit with geofences on iOS (related thread) and have a related question.

If the user swipe-kill the app, the geofences also stop working. And the app doesn't get an event when it gets swipe-killed, I've read in many threads here in the forum.

However, can I do something reliable so that once the user at some later point manually launch the app, I put up a message "Last time you used this app, you swipe-killed it. Please don't do that again as it makes the geofences stop working."

The only half-baked ideas I have are these:

1. Check existing geofences
The theory being that there should be current geofences for the app. (As it detects them in the background.) If the app could get the currently active geofences for the app from the OS, and the list is empty, that could be an indicator that a swipe-kill was performed. (I don't even know if it's possible to get a list of the apps currently registered geofences from the OS.)

2. Use local file as flag
When user manually launch app, create an empty file "alive.txt" somewhere private. When app is normally purged from memory, delete the file. (If I remember correctly we get an event for that.) So when the user swipe-kills and at a later point manually launches the app, we can see that we have an unexpected file "alive.txt" there. Which would mean that it is a left-over from a previous swipe-kill.

Thoughts?
 
Last edited:

Sandman

Expert
Licensed User
See the thread linked in post #3. The geofences continue to work even if the app is swipe-killed, so there is no need to solve my question in post #1.
 
Upvote 0
Top