码迷,mamicode.com
首页 > 移动开发 > 详细

android 解锁 点亮屏幕

时间:2014-07-29 18:04:13      阅读:236      评论:0      收藏:0      [点我收藏+]

标签:android

 
//保持屏幕常亮 
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); 
mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, LOCK_TAG); 

mWakeLock.acquire(); 


 
//释放屏幕常亮锁 
if(null != mWakeLock) { 
    mWakeLock.release(); 


 
//屏幕解锁 
KeyguardManager keyguardManager = (KeyguardManager)getSystemService(KEYGUARD_SERVICE); 
KeyguardLock keyguardLock = keyguardManager.newKeyguardLock(LOCK_TAG); 
keyguardLock.disableKeyguard(); 
//屏幕锁定 
keyguardLock.reenableKeyguard(); 


 
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> 
<uses-permission android:name="android.permission.WAKE_LOCK" /> 

android 解锁 点亮屏幕,布布扣,bubuko.com

android 解锁 点亮屏幕

标签:android

原文地址:http://blog.csdn.net/lian_1988/article/details/38270993

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!