Android 开机应用自启无锁屏及保持屏幕常亮
//保持屏幕常亮状态
public static void eepScreenOn(Activity context){
WakeLock screenLock = ((PowerManager)context.getSystemService(context.POWER_SERVICE)).newWakeLock(
PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "TAG");
screenLock.acquire();
context.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
screenLock.release();
}
//应用开机自启后无锁屏界面
getWindow().setFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD, WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
版权声明:如无特殊标注,文章均为本站原创,转载时请以链接形式注明文章出处。
评论