0

I'm trying to make my widget update periods configurable through the use of the AlarmManager. I've now got this working by implementing the onReceive() method in my AppWidgetProvider which in turn calls the onUpdate() method of the AppWidgetProvider when it receives a broadcast of my alarm. This appears to be working, though I am still struggling to understand certain scenarios.

Last night, I configured the alarm to update every hour and to not wake the phone up. As you can see from the out adb shell dumpsys alarm below, I've successfully registered a RTC alarm to execute every hour:

RTC #1: Alarm{40b354b0 type 1 com.my.app}
type=1 when=+59m40s6ms repeatInterval=3600000 count=1
operation=PendingIntent{40c11e70: PendingIntentRecord{40e2b290 com.my.app broadcastIntent}}

Anyway, I unplugged my phone, turned the screen off and went to bed. In my onReceive() method, I output log messages to a file to ensure I capture what is going on. This morning I took a look at the log and discovered that my onRecieve() method fired every hour without fail. It never slept through a single alarm.

Why is this the case? While I suppose its possible other processes or alarms are waking up my phone, it seems suspicious. Can anyone offer any information or advice?

Finally, does anyone know what the count=1 means in my output above?

Chris Knight
  • 24,333
  • 24
  • 88
  • 134
  • possible duplicate of [Allowing the phone to sleep while using RTC alarm on Android](http://stackoverflow.com/questions/6112327/allowing-the-phone-to-sleep-while-using-rtc-alarm-on-android) – Dan Hulme Jul 01 '13 at 10:12

1 Answers1

0

This has been answered at

Allowing the phone to sleep while using RTC alarm on Android

and is a common issue.

I don't know what count = 1 means though.

Community
  • 1
  • 1
El Duderino
  • 499
  • 2
  • 4
  • 15