Android Using Application Context Inside Widget For Pending Intent -
a widgetprovider button use pendingintent
communicate.
inside onupdate(context ...)
method of widetprovider following line appears:
pendingintent buttonpendingintent = pendingintent.getbroadcast(context, 0, buttonintent, pendingintent.flag_update_current);
which context being passed in widget manager android?
is ok use context.getapplicationcontext()
pendingintent
? have found widget freezes of time , different application conditions, though onupdate gets called. using context.getapplicationcontext()
seems help.
your widgetprovider.onupdate()
called result of appwidgetmanager.action_appwidget_update broadcast. see source, line 52.
javadoc of 'broadcastrerceiver.onreceive()` says:
...you should never perform long-running operations in it...
so, check not doing long running tasks inside onupdate()
might cause of freezes experiencing.
Comments
Post a Comment