android AlarmManager not waking phone up

后端 未结 3 497
借酒劲吻你
借酒劲吻你 2020-11-27 14:29

I want an activity to be displayed at a certain time. For this, I am using AlarmManager. It works fine when the device is awake, but it doesn\'t wake it up if it\'s asleep.<

3条回答
  •  無奈伤痛
    2020-11-27 14:55

    For Services (maybe works for activity as well), extend your AlarmReceiver from WakefulBroadcastReceiver, it acquires WAKE_LOCK for you while intent is being processed.

    WakefulBroadcastReceiver docs - https://developer.android.com/reference/android/support/v4/content/WakefulBroadcastReceiver.html

    Keeping device awake guide - https://developer.android.com/training/scheduling/wakelock.html

提交回复
热议问题