码迷,mamicode.com
首页 > 其他好文 > 详细

仿QQ锁屏界面消息提示

时间:2015-12-21 15:53:13      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:

唤醒屏幕:

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" />

仿QQ锁屏界面消息提示

标签:

原文地址:http://www.cnblogs.com/tutuskys/p/5063460.html

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