onDataSetChanged() in RemoteViewService is not called after notifyAppWidgetViewDataChanged

In my AppWidgetProvider class I have the following code inside the onUpdate() method:

    // Update each of the widgets with the remote adapter
    for (int appWidgetId : appWidgetIds) {
        HyperLog.i(TAG, "Updating Widget id " + appWidgetId);

        ...

        HyperLog.i(TAG, "Starting updateAppWidget with id " + appWidgetId);
        appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetId, R.id.lvActiveReminders);
        appWidgetManager.updateAppWidget(appWidgetId, rv);
    }
    super.onUpdate(context, appWidgetManager, appWidgetIds);

But the call notifyAppWidgetViewDataChanged() does not call the RemoteViewService Class method onDataSetChanged():

        HyperLog.i(TAG, "onDataSetChanged is called.");
        getData();

Does anyone hava a hint why it is not called?

The onUpdate() inside AppWidgetProvider is always called and the updateAppWidget refreshes the widget, but with the old data because onDataSetChaned() is not called before.
As of the docs this is the way how we should refresh the data of the widget (Use widget collections  |  Android Developers).

I am testing this on an Android 12 device.

There is not a lot of help for Android discussion on this forum. It is mainly for SDK and Samsung Tools discussion. I’ll let it stay but you may want to look somewhere else for assistance as well.

Ron
Moderator
Samsung Developer Relations