2

I am updating the widget from service(srvice and widget class are in two different package) like this

AppWidgetManager widgetManager = AppWidgetManager.getInstance(this);
ComponentName widgetComponent = new ComponentName(this,MyWidgetProvider.class);
int[] widgetIds = widgetManager.getAppWidgetIds(widgetComponent);
Intent update = new Intent();
update.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, widgetIds);
 update.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
sendBroadcast(update);

it updates my widget but the problem is that it also updating other widgets of the device too because of which my widget updates after all the widget gets updated.

So now I want to update only my widget how can i do that

Shakeeb Ayaz
  • 6,200
  • 6
  • 45
  • 64

1 Answers1

1

According Android documentation getAppWidgetIds return a list of id that have been bound to specific WidgetProvider, that is all your widget instance id not id of widgets under other WidgetProvider.

Jans
  • 11,064
  • 3
  • 37
  • 45
  • so what is the solution ,i am stuck – Shakeeb Ayaz Jul 20 '13 at 03:49
  • when you call `getAppWidgetIds` only id that correspond to your widgets are returned and no widget of other `WidgetProvider`. so the intent of update widgets is on your widgets instances. – Jans Jul 21 '13 at 19:51