简体   繁体   English

使AlarmManager能够唤醒电话

[英]Making alarmManager able to wakeup the phone

I've adapted the code in http://code4reference.com/2012/07/tutorial-on-android-alarmmanager/ taking a picture every 30 sec. 我已经调整了http://code4reference.com/2012/07/tutorial-on-android-alarmmanager/中的代码,每30秒拍照一次。 It works ok but when the phone goes in sleep mode it seems that the alarmManager does not make its job properly. 它可以正常工作,但是当手机进入睡眠模式时,alarmManager似乎无法正常工作。 Is there a way to make alarmManager able to wakeup the phone? 有没有办法使AlarmManager能够唤醒电话?

You need to implement a WakeLock. 您需要实现一个WakeLock。

http://developer.android.com/reference/android/os/PowerManager.WakeLock.html http://developer.android.com/reference/android/os/PowerManager.WakeLock.html

This requires a specific permission, and is generally frowned upon by users. 这需要特定的许可,并且通常被用户拒绝。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM