简体   繁体   中英

Stop android device from sleeping

我正在尝试开发一个非常简单的应用程序,该应用程序可以像图像幻灯片一样显示,我肯定无法确定(如果有人提出任何建议,将不胜感激),但是我想知道有什么方法可以停止该设备这些图像在睡觉时是否会进入睡眠状态?

using

     getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

will make the screen always on which will disable the lock. Remove it by using

     getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

Add android:keepScreenOn="true" to some widget in your activity's layout XML file. While the activity is in the foreground, the device will not fall asleep.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM