唤醒屏幕:
1 PowerManager pm = (PowerManager) context2 .getSystemService(Context.POWER_SERVICE);3 WakeLock mWakeLock = pm.newWakeLock(4 PowerManager.ACQUIRE_CAUSES_WAKEUP5 | PowerManager.SCREEN_DIM_WAKE_LOCK, "SimpleTimer");6 mWakeLock.acquire();7 mWakeLock.release();
需要权限:<uses-permission android:name="android.permission.WAKE_LOCK" />
锁屏显示消息:
1 KeyguardManager keyguardManager = (KeyguardManager) context2 .getSystemService(Context.KEYGUARD_SERVICE);3 KeyguardLock keyguardLock = keyguardManager.newKeyguardLock("");4 keyguardLock.disableKeyguard();
需要权限:<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />