Code example for AppWidgetManager

Methods: getAppWidgetIds

0
	 
	protected void initWidetService(Context context, AppWidgetManager appWidgetManager) {
		 
		ComponentName thisWidget = new ComponentName(context, Widget41.class);
		 
		int[] allWidgetIds = appWidgetManager.getAppWidgetIds(thisWidget);
 
		// Build the intent to call the service 
		Intent intent = new Intent(context.getApplicationContext(), WidgetService41.class);
		intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, allWidgetIds);
 
		// Update the widgets via the service 
		context.startService(intent);
	}	 
 
}