android唤醒屏幕

 权限


 

唤醒屏幕代码PowerManager mPowerManager = (PowerManager) activity.getSystemService(POWER_SERVICE);
PowerManager.WakeLock mWakeLock = mPowerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "tag");mWakeLock.acquire(60*1000L /*1 minutes*/);

解锁屏幕代码
KeyguardManager.KeyguardLock mUnLock;
KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
assert keyguardManager != null;
mUnLock = keyguardManager.newKeyguardLock("unLock");
mUnLock.disableKeyguard();

你可能感兴趣的:(整理)