Search code examples
androidandroid-appwidget

Update AppWidget from an Activity


I'm trying to update my AppWidget from my activity. Similar to this question:

Programmatically update widget from activity/service/receiver

I'm using AppWidgetManager to get the ids and send an update broadcast but it doesn't work for me.

I suspect that it's because my AppWidgetProvider is in a library project and thus under a different package than my main app.

Any ideas on how to make it work? I tried all kind of contexts (this, getApplication() , etc.) , nothing worked. (I don't get the ids of the widgets).

Thanks.


Solution

  • I had to use the package name of the app in component name and the full classname in the library in the class.