android AlarmManager not waking phone up

后端 未结 3 504
借酒劲吻你
借酒劲吻你 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:53

    Most likely, the alarm is waking up the device. However, AlarmManager broadcasts won't turn the screen on, and the device may well fall back asleep before your activity starts up.

    You will need to acquire a WakeLock in onReceive() before calling startActivity(), and release that WakeLock after the user responds to your activity.

提交回复
热议问题