Hello I was reading on android docs about these two constans of AlarmManager
but didn't get exactly the difference between them.
RTC Alarm time in System.currentTimeMillis() (wall clock time in UTC).
RTC_WAKEUP Alarm time in System.currentTimeMillis() (wall clock time in UTC), which will wake up the device when it goes off.
Does not RTC
wake up the device and fire the PendingIntent
when device is in sleeping mode ?
Thanks in advance.
Does not RTC wake up the device and fire the PendingIntent when device is in sleeping mode ?
RTC
and ELAPSED_REALTIME
do not wake up the device out of sleep mode. If the device is in sleep mode at the time of the event, nothing immediately happens. You will be notified about missed events when the device wakes up for other reasons (e.g., user presses the power button).
RTC_WAKEUP
and ELAPSED_REALTIME_WAKEUP
will wake up the device out of sleep mode. If your PendingIntent
is a broadcast PendingIntent
, Android will keep the device awake long enough for onReceive()
to complete. If you have significant work, that you do not want to do in onReceive()
(because onReceive()
is called on the main application thread), you will need to arrange to keep the device awake long enough for some service of yours to complete the work, such as by using WakefulBroadcastReceiver
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With