iOS Question Best practice when "pausing" geofences?

Sandman

Well-Known Member
Licensed User
Let's say I have defined ten geofences in my app, and all is working fine.

Now the user wants to pause the detection for a period, lets say 24 hours. What is the best practice to "pause" the fences, and make sure they "activate" again in 24 hours?

I've managed to find two strategies, but I'm not really sure which is best. Plus I might have missed some other solution.

Alternative 1: Delete and schedule
- Delete the geofences
- Schedule a local notification for 24 hours ("The 24 hours has passed, press here to start the geofences again")
- When user taps notification, restore the geofences

Arguments FOR: Less battery use, simple for user to prolong the 24 hours (by not tapping notification)
Arguments AGAINST: User might not tap notification - so geofences might not get activated again

Alternative 2: Stay active but silent
- Keep the geofences and get events
- Don't act on them for 24 hours

Arguments FOR: Guaranteed to work again after 24 hours
Arguments AGAINST: More battery use (probably not a big issue)

Thoughts?
 

DonManfred

Expert
Licensed User
Arguments AGAINST: User might not tap notification - so geofences might not get activated again
use a service. Schedule it to run in 24 hours. when the service starts, restore the Geofences. No need for a notification. No need to run your app all the time.
Pros: nearly zero batteryuse as your app is doing nothing.

Note not to use the Starter Service for this. Use any other Service. Maybe a dummy one "RestoreGeoFences"....

With this additions i would use Plan A.

PD: Sorry, didn´t saw it is a B4i question but i guess it should work like this in B4i too ;-)
 
Top