List of usage examples for android.appwidget AppWidgetManager getAppWidgetIds
public int[] getAppWidgetIds(ComponentName provider)
From source file:mx.klozz.xperience.tweaker.helpers.Helpers.java
public static void updateAppWidget(Context context) { AppWidgetManager widgetManager = AppWidgetManager.getInstance(context); ComponentName widgetComponent = new ComponentName(context, Widget.class); int[] widgetIds = widgetManager.getAppWidgetIds(widgetComponent); Intent update = new Intent(); update.setAction("mx.klozz.xperience.tweaker.ACTION_FREQS_CHANGED"); update.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, widgetIds); context.sendBroadcast(update);/*from w w w . j a v a 2s .c o m*/ }
From source file:com.udacity.stockhawk.widget.StockAppWidgetProvider.java
@Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); if (QuoteSyncJob.ACTION_DATA_UPDATED.equals(intent.getAction())) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, getClass())); appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.lv_stock_list); }// www .ja v a2 s. com }
From source file:com.johan.vertretungsplan.SettingsActivity.java
@Override public void onPause() { super.onPause(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences.Editor prefEditor = prefs.edit(); prefEditor.putBoolean("isInForeground", false); prefEditor.commit();/* ww w. jav a 2 s . c o m*/ AppWidgetManager mgr = AppWidgetManager.getInstance(this); int[] ids = mgr.getAppWidgetIds(new ComponentName(this, VertretungsplanWidgetProvider.class)); new VertretungsplanWidgetProvider().onUpdate(this, mgr, ids); }
From source file:com.example.olivi.maphap.widget.DetailWidgetProvider.java
@Override public void onReceive(@NonNull Context context, @NonNull Intent intent) { super.onReceive(context, intent); if (MapHapService.ACTION_DATA_UPDATED.equals(intent.getAction())) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, getClass())); appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.widget_list); }/* w w w . j av a 2 s.c om*/ }
From source file:com.xengar.android.stocktracker.widget.ListWidgetProvider.java
@Override public void onReceive(@NonNull Context context, @NonNull Intent intent) { super.onReceive(context, intent); if (QuoteSyncJob.ACTION_DATA_UPDATED.equals(intent.getAction())) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, getClass())); appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.widget_list); }/* w ww . ja v a 2 s . c o m*/ }
From source file:barqsoft.footballscores.widget.WidgetListProvider.java
@Override public void onReceive(@NonNull Context context, @NonNull Intent intent) { super.onReceive(context, intent); if (ScoresSyncAdapter.ACTION_DATA_UPDATED.equals(intent.getAction())) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, getClass())); //This method will trigger WidgetListRemoteViewsService RemoteViewsFactory // .onDataChanged() and update the widget UI appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.widget_list); }/* w w w . ja v a 2 s . c om*/ }
From source file:com.johan.vertretungsplan.background.VertretungsplanService.java
@Override protected void onHandleIntent(Intent intent) { context = this; settings = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); extras = intent.getExtras();/*from ww w. j a v a2 s. c o m*/ Gson gson = new Gson(); boolean autoSync; try { autoSync = extras.getBoolean("AutoSync"); } catch (NullPointerException e) { autoSync = false; } ConnectivityManager conMan = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); //wifi State wifi = conMan.getNetworkInfo(1).getState(); if (wifi == NetworkInfo.State.CONNECTED || autoSync == false || settings.getBoolean("syncWifi", false) == false) { Log.d("Vertretungsplan", "WiFi state: " + wifi); Log.d("Vertretungsplan", "autoSync: " + autoSync); Log.d("Vertretungsplan", "syncWifi: " + Boolean.valueOf(settings.getBoolean("syncWifi", false))); Log.d("Vertretungsplan", "Vertretungsplan wird abgerufen"); try { BaseParser parser = ((VertretungsplanApplication) getApplication()).getParser(); if (parser == null) return; Vertretungsplan v = parser.getVertretungsplan(); settings.edit().putString("Vertretungsplan", gson.toJson(v)).commit(); AppWidgetManager mgr = AppWidgetManager.getInstance(this); int[] ids = mgr.getAppWidgetIds(new ComponentName(this, VertretungsplanWidgetProvider.class)); new VertretungsplanWidgetProvider().onUpdate(this, mgr, ids); } catch (IOException | JSONException e) { e.printStackTrace(); } catch (VersionException e) { } catch (UnauthorizedException e) { } } }
From source file:com.udacity.stockhawk.ui.widget.StockWidget.java
@Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); if (QuoteSyncJob.ACTION_DATA_UPDATED.equals(intent.getAction())) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); appWidgetManager.notifyAppWidgetViewDataChanged( appWidgetManager.getAppWidgetIds(new ComponentName(context, getClass())), R.id.lv_widget_stock); }// w w w . j ava 2 s. c om }
From source file:co.carlosjimenez.android.currencyalerts.app.widget.DetailWidgetProvider.java
@Override public void onReceive(@NonNull Context context, @NonNull Intent intent) { super.onReceive(context, intent); if (ForexSyncAdapter.ACTION_DATA_UPDATED.equals(intent.getAction())) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, getClass())); appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.widget_list); }/* w w w . j ava 2 s.c om*/ }
From source file:com.android.mms.widget.MmsWidgetProvider.java
@Override public void onReceive(Context context, Intent intent) { if (Log.isLoggable(LogTag.WIDGET, Log.VERBOSE)) { Log.v(TAG, "onReceive intent: " + intent); }//from ww w.j a va 2s . c o m String action = intent.getAction(); // The base class AppWidgetProvider's onReceive handles the normal widget intents. Here // we're looking for an intent sent by the messaging app when it knows a message has // been sent or received (or a conversation has been read) and is telling the widget it // needs to update. if (ACTION_NOTIFY_DATASET_CHANGED.equals(action)) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); int[] appWidgetIds = appWidgetManager .getAppWidgetIds(new ComponentName(context, MmsWidgetProvider.class)); // We need to update all Mms appwidgets on the home screen. appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.conversation_list); } else { super.onReceive(context, intent); } }