Android startService 启动自动解锁点亮屏幕

2014-11-24 09:24:32 · 作者: · 浏览: 1

做提醒功能的一个服务,自动解锁+亮屏。


用startService 启动的,屏幕一直不会彻底变黑,在Activity的stop方法中stopService,
然后再Service的destory方法中将亮屏的给释放 mWakelock.release();
这样就不会一直亮着了。




屏幕虽然亮了,可是并没有像正常操作那样的彻底变亮啊,这种让屏幕变亮只是亮一点,还是很暗。



public void acquire () //该方法只是确保屏幕会被唤醒
Makes sure the device is on at the level you asked when you created the wake lock.

public void acquire (long timeout) //参数表示唤醒的时间,时间过后,会自动释放该锁
Makes sure the device is on at the level you asked when you created the wake lock. The lock will be released after the given timeout.


API有个参数可以点亮