Hello roe888,
It seems to be working right now! I had tried doing that from nearly everywhere (even in response to a PACKAGE_REPLACED to no avail). Thanks a lot on the tip and sorry for nagging the list so much.
For the record this is my code:
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
Log.i(TAG, "onUpdate");
Intent intent = new Intent(context.getApplicationContext(), UpdateService.class);
// for (int i : appWidgetIds)
// Log.i(TAG, Integer.toString(i));
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds);
//start data update service
context.startService(intent);
// Construct views
....
// Setup refresh on click
// If no specific widgets requested, collect list of all
if (appWidgetIds == null) {
appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, TheWidget.class));
}
// Tell the widget manager
final int N = appWidgetIds.length;
for (int i = 0; i < N; i++) {
int appWidgetId = appWidgetIds[i];
appWidgetManager.updateAppWidget(appWidgetId, views);
//forces the widget to recreate the listview. Especially
//important when reinstalling the app
resetWidget(context, appWidgetId);
}
}
protected void resetWidget(Context context, int mAppWidgetId) {
AppWidgetManager mAppWidgetManager = AppWidgetManager.getInstance(context);
final AppWidgetProviderInfo appWidgetInfo = mAppWidgetManager.getAppWidgetInfo(mAppWidgetId);
appwidgetReadyBroadcast(context, mAppWidgetId, appWidgetInfo.provider);
}
protected void appwidgetReadyBroadcast(Context context, int appWidgetId, ComponentName cname) {
Log.d("appwidgetReadyBroadcast: ", cname.getPackageName() + "to widget #"+appWidgetId);
Intent ready = new Intent(LauncherIntent.Action.ACTION_READY)
.putExtra(LauncherIntent.Extra.EXTRA_APPWIDGET_ID, appWidgetId)
.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
.putExtra(LauncherIntent.Extra.EXTRA_API_VERSION, 2).setComponent(cname);
context.sendBroadcast(ready);
}
Again thanks for the tip.
Cheers,
V. Segui
P.S.: The scrollable-contacts widget seems to suffer from this issue too, should I open an issue and try to send a patch?