Hello
I 'm working with GPS in my application. When phone go to sleep, the GPS's data don't update. I want to stay phone screen wake up until my app will be close. How can I prevent sleeping in Android?
Hello
I 'm working with GPS in my application. When phone go to sleep, the GPS's data don't update. I want to stay phone screen wake up until my app will be close. How can I prevent sleeping in Android?
Use a WakeLock
. Bear in mind that using a WakeLock
for a long period of time will drain the battery, which your users may not appreciate.
I'd try to have the GPS related stuff running as a service in the background so you don't have to keep the screen active.