AppWidget: instance does not appear after configuration completes on some devices

I found strange behavior on some devices when adding a new instance of appwidget to the main screen.

I have an AppWidget application with configuration. As the appwidget tutorial update said, I have to do it myself.

public static void updateWidgetAndSendIntent (Activity activity, int mAppWidgetId, boolean isUpdate) { updateWidgets(activity); if (!isUpdate) { Intent resultIntent = new Intent(); resultIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId); activity.setResult(Activity.RESULT_OK, resultIntent); activity.finish(); } } public static void updateWidgets(Context context) { new ManagerUpdateWidget(context).updateAllWidgetInstances(); } 

ManagerUpdateWidget.java

  public void updateAllWidgetInstances() { Bitmap widget = getCustomView(context); for (int widgetId : appWidgetIds) { updateCurrentInstance(widgetId, widget); } } 

The fact is that on the Samsung Galaxy Note 2 (GT-N7100) with Android 4.4.2 everything is fine, but on the Samsung Galaxy Note 3 (SM-N900) with Android 5.0 I have a "phantom" appwidget, and not a real appawidget on the main screen, but β€œphantom”, when you do not see the appwidget on the screen, but inside your application the Appwidget exists with an identifier and regular updates. I tested my application on genymotion emulators (Android 4.3 and 5.0), but everything was fine.

Please tell me how to fix this strange error.

+7
android android-appwidget
source share
1 answer

Working with phantom hangs in a nightmare. Can you update all instances with updateAppWidget (ComponentName provider, RemoteViews views) ?
According to the documentation, this method will install RemoteViews for use with all instances of AppWidget for the supplied AppWidget provider.

 AppWidgetManager manager = AppWidgetManager.getInstance(context); ComponentName component = new ComponentName(context, MyAppWidgetProvider.class); manager.updateAppWidget(component, remoteViews); 
0
source share

All Articles