android - AppWidgetProvider onEnabled() -- is widget list known at that point? -
i use alarmmanager
set repeating alarm each widget updating purposes. it's working well, on devices.
in order re-establish alarms after reboot, relying on onenabled()
method, since called once group of app widgets. , in that, have following:
alarmmanager alarmmanager = (alarmmanager) context.getsystemservice(context.alarm_service); appwidgetmanager appwidgetmanager = appwidgetmanager.getinstance(context); int appwidgetids[] = appwidgetmanager.getappwidgetids(new componentname(context, myappwidgetprovider.class)); (int appwidgetid : appwidgetids) { // call function set repeating alarm widget (including doing widget update now)... updateappwidgetalarm(context, appwidgetid, appwidgetmanager, alarmmanager); }
whilst seems work in cases, appears devices onenabled()
method not doing @ all. know being called, logging put in, nothing happening.
i suspect maybe appwidgetids
array empty, because @ time after reboot list has not yet been populated. put in more logging see if correct.
am using onenabled()
not intended? should appwidgetids
array have meaningful content @ point in app widgets' lifecycle?
i have tried delaying above stuff short time wrapping inside handler.postdelayed()
, uncertain results.
Comments
Post a Comment