MIPs
unread,Jun 16, 2011, 5:03:06 PM6/16/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to phon...@googlegroups.com
I have an app that is using geolocation services (PhoneGap 0.9.5.1 on iOs 4.3).
It is designed to run in background as it tracks the user. So I have used "App registers for location updates". That works fine and even if the user runs another app, mine keeps logging their location as designed.
When the app starts it has to immediately start using Geolocation to enable the GPS and get an accuracy reading. The user then starts the tracking when they are ready. When they have finished, they can stop tracking, but the app needs to continue to access Geolocation services in case they start again and to maintain the GPS lock.
But of course the battery usage is terrible. That is fine when the user wants the app to track their location, but once they have completely finished how do I turn off Geolocation when the app moves into background?
I have intercepted the "pause" event and at that point clear the interval function that is calling navigator.geolocation.getCurrentPosition() if they are not tracking at the time, renabling on "resume", but the icon showing Geolocation services are active remains and battery life would suggest that the service is using power.
At the moment the only way to reduce to stop the power usage is to terminate the program - but many user would not know how to do that or that they need to and I suspect Apple will reject the app on those grounds.
Any suggestions would be appreciated.