开发者

How to prevent sleeping in Android

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 sl开发者_C百科eeping 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜