android - How to update widgets from a service? -


I have a background service that can be configured to perform some action every x minute. I implemented that widget I want to do that every time my service fulfills that action. However, I can not get an AppWidgetProvider's up-department method called in any way other than adding a widget to the homepage.

I tried to send the intention of APPWIDGET_UPDATE but the update did not receive the call, although the AppWidgetProvider received the intent was called after the only method. Either way can I trigger a widget update from a service?

Just make yourself a RemoteViews and widget (s) directly Update in service . You will get through your AppWidgetManager :

  AppWidgetManager mgr = AppWidgetManager.getInstance (this);  

Everything else is normal.

Note: - If you really want to work current AppWidgetProvider , send a broadcast with custom action on your component, and Please call at at Resave () at Update ().


Comments