I am developing an app that tracks the users movement over GPS (bike riding in particular) and I realized that when the screen auto-locks, the app would stop running (if I'm not mistaken, I'm not completely certain on this).
Is there a way to prevent the phone from auto-locking? Or as an alternative, is there a way (by using Phonegap) to keep on tracking the user's movement after the screen auto-locks (as a background process of some sort)?
Thank you.
I'm pretty sure you need to use a
Servicefor this.Servicescan be started byActivitiesto run in the background - i.e. you could start theServicein theonPause()method of yourActivity.Source: http://developer.android.com/guide/topics/fundamentals.html
Google provides developers with a guide to using
Serviceson the Android developer site. Here's the direct link: http://developer.android.com/guide/topics/fundamentals/services.html