我需要禁用锁定屏幕,同时禁用黑屏.. 我需要在我的服务的onStart中执行此操作。
通过这个禁用锁定屏幕,这很有效:
KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE);
KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
lock.disableKeyguard();
如何禁用黑屏? 我试过这个但是不行......
PowerManager pm2 = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wakel = pm2.newWakeLock(PowerManager.FULL_WAKE_LOCK, "AttvaSchermo");
wakel.acquire();
或活动..
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
提前感谢!