android 点亮手机屏幕与屏幕解锁方法
点亮手机屏幕
1.记得加权限<uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission>
[html]
PowerManager pm = (PowerManager)getSystemService(POWER_SERVICE);
PowerManager.WakeLock mWakelock = pm.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP |PowerManager.FULL_WAKE_LOCK, "WakeLock");
mWakelock.acquire();//唤醒屏幕
//......
mWakelock.release();//释放
屏幕解锁
1.记得加权限<uses-permission android:name="android.permission.DISABLE_KEYGUARD"></uses-permission>
[html]
//获取一个键盘锁对象
KeyguardManager mManager = (KeyguardManager)getSystemService(KEYGUARD_SERVICE);
KeyguardLock mKeyguardLock = mManager.newKeyguardLock("Lock");
//让键盘锁失效
mKeyguardLock.disableKeyguard();
补充:移动开发 , Android ,