Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent sleeping in Android

Tags:

android

sleep

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?

like image 771
vic Avatar asked Sep 05 '10 19:09

vic


1 Answers

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.

like image 59
CommonsWare Avatar answered Oct 14 '22 01:10

CommonsWare