I'm working with the emulator using the debugger and I've noticed that onUpdate()
is not getting called. When I add the widget to the emulator homescreen I see my breakpoint being hit in the onReceive method. The onReceive()
method does get the android.appwidget.action.APPWIDGET_UPDATE
intent. However, the onUpdate()
method never gets called. I believe it's defined correctly.
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager,int[] appWidgetIds) {
// code that sets up remove view and updates appWidgetManager
}
Call the super class method in onReceive()
@Override
public void onReceive(Context context, Intent intent)
{
// Chain up to the super class so the onEnabled, etc callbacks get dispatched
super.onReceive(context, intent);
// Handle a different Intent
Log.d(TAG, "onReceive()" + intent.getAction());
}
If you override onReceive() in your subclassed AppWidgetProvider, then the provider's onEnabled, onUpdate, etc callbacks are not triggered unless you call the superclass.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With