- May 9, 2014
- 2
- 0
- 0
Hi all.
I have an app which uses the Geolocator class to track your location. It works great, except there is a condition that I'm having issues with.
My app notifies the user when they are approaching a location, but what I want is to adjust the frequency (ReportInterval) of position changed events depending on how far away they are from the location. The reason being that I want to conserve battery power by not updating too frequently when the user is far away.
I've built all the logic for adjusting the ReportInterval and restarting the Geolocator (it simply removes the event handlers for positionchanged/statuschanged), sets the property and adds the handlers again.
This works great with the app open, but when the app is running in the background it causes the geolocator to stop. As soon as I drop the event handlers, the service stops and the app is tombstoned.
Is there any way to get around the app being tombstoned while I restart the service?
Thanks
I have an app which uses the Geolocator class to track your location. It works great, except there is a condition that I'm having issues with.
My app notifies the user when they are approaching a location, but what I want is to adjust the frequency (ReportInterval) of position changed events depending on how far away they are from the location. The reason being that I want to conserve battery power by not updating too frequently when the user is far away.
I've built all the logic for adjusting the ReportInterval and restarting the Geolocator (it simply removes the event handlers for positionchanged/statuschanged), sets the property and adds the handlers again.
This works great with the app open, but when the app is running in the background it causes the geolocator to stop. As soon as I drop the event handlers, the service stops and the app is tombstoned.
Is there any way to get around the app being tombstoned while I restart the service?
Thanks