android - Updating widget frequently using alarm manager -
i have widget need update new content while device awake.
i use alarm manager , set alarm type either elapsed_realtime or rtc, suggested on "app widgets" guidelines on android developer site.
the problem need update widget every 5 seconds (probably configurable) while screen on.
wherever searched people 5 seconds insane, haven't yet understand if gonna problem if update when device awake. there different approach can take problem? how clock widgets this?
while experimenting realized when screen goes off alarm still triggers. stops triggering when device goes deep sleep, in case 5 seconds few anyway device have time go sleep.
so did filter screen_on broadcast , schedule alarm every 5 seconds. filter screen_off broadcast , cancel alarm.
Comments
Post a Comment