标签:
唤醒屏幕:
1 PowerManager pm = (PowerManager) context 2 .getSystemService(Context.POWER_SERVICE); 3 WakeLock mWakeLock = pm.newWakeLock( 4 PowerManager.ACQUIRE_CAUSES_WAKEUP 5 | PowerManager.SCREEN_DIM_WAKE_LOCK, "SimpleTimer"); 6 mWakeLock.acquire(); 7 mWakeLock.release();
需要权限:<uses-permission android:name="android.permission.WAKE_LOCK" />
锁屏显示消息:
1 KeyguardManager keyguardManager = (KeyguardManager) context 2 .getSystemService(Context.KEYGUARD_SERVICE); 3 KeyguardLock keyguardLock = keyguardManager.newKeyguardLock(""); 4 keyguardLock.disableKeyguard();
需要权限:<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
标签:
原文地址:http://www.cnblogs.com/tutuskys/p/5063460.html