/** * Called when the BroadcastReceiver receives an Intent broadcast. Checks to see whether the * intent's action is _listClickAction. If it is, the app widget displays a Toast message for the * current item. */ @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(_listClickAction)) { // ---Launch video search in the browser--- String searchText = intent.getStringExtra("search_text"); String linkScheme1 = intent.getStringExtra("scheme1"); String linkScheme2 = intent.getStringExtra("scheme2"); Intent browserIntent = null; // new Intent(_listClickAction); try { browserIntent = new Intent( Intent.ACTION_VIEW, Uri.parse(linkScheme1 + URLEncoder.encode(searchText, "UTF-8") + linkScheme2)); } catch (UnsupportedEncodingException e) { BugSenseHandler.sendExceptionMessage("Widget4x4Provider", "onReceive", e); Crashlytics.setString("Widget4x4Provider", "onReceive"); Crashlytics.logException(e); if (ApplicationContext.DEBUG_MODE) e.printStackTrace(); } browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); browserIntent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName()); context.startActivity(browserIntent); } else if (intent.getAction().equals("android.appwidget.action.APPWIDGET_UPDATE")) { // ---Update the widget with latest search--- final AppWidgetManager mgr = AppWidgetManager.getInstance(context); onUpdate(context, mgr, appWidgetIds); } super.onReceive(context, intent); }
@Override public void onReceive(Context context, Intent intent) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); int id = intent.getIntExtra( AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); String date = intent.getStringExtra(EXTRA_DATE); switch (intent.getAction()) { case ACTION_PREVIOUS_CLICK: RemoteViews remoteViews = getRemoteViews(context, id, date); if (remoteViews != null) { mSharedPreferenceHelper.setDateForWidget(date); appWidgetManager.updateAppWidget(id, remoteViews); } break; case ACTION_NEXT_CLICK: RemoteViews remoteViews1 = getRemoteViews(context, id, date); if (remoteViews1 != null) { appWidgetManager.updateAppWidget(id, remoteViews1); } break; case ACTION_TODAY_CLICK: RemoteViews remoteViews2 = getRemoteViews(context, id, date); if (remoteViews2 != null) { mSharedPreferenceHelper.setDateForWidget(date); appWidgetManager.updateAppWidget(id, remoteViews2); } break; case ACTION_UPDATE: int[] appWidgetIds = intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS); setRemotes(context, AppWidgetManager.getInstance(context), appWidgetIds); break; case ACTION_UPDATE_NOTE: appWidgetManager.notifyAppWidgetViewDataChanged( intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS), R.id.list_widget); break; case ACTION_HEADER_CLICK: Intent i = new Intent(context, MainActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); break; } super.onReceive(context, intent); }
@Override public void onReceive(@NonNull Context context, @NonNull Intent intent) { super.onReceive(context, intent); if (ACTION_REFRESH.equals(intent.getAction())) { handleRefreshAction(context, intent); } }
@Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub String action = intent.getAction(); if (AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action) || action.equals(_myaction)) { int[] IDs = null; if (action.equals(_myaction)) { ComponentName provdier = new ComponentName(context, this.getClass()); IDs = AppWidgetManager.getInstance(context).getAppWidgetIds(provdier); } Bundle extras = intent.getExtras(); int[] appWidgetIds; if (extras != null || IDs != null) { if (extras != null) appWidgetIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS); else appWidgetIds = IDs; if (appWidgetIds != null && appWidgetIds.length > 0) { if (appWidgetIds.length == 1) { this.onUpdate(context, AppWidgetManager.getInstance(context), appWidgetIds); } else if (appWidgetIds[0] < appWidgetIds[1]) { for (int i = 0; i < appWidgetIds.length; i++) { int[] tempappWidgetIds = {appWidgetIds[i]}; this.onUpdate(context, AppWidgetManager.getInstance(context), tempappWidgetIds); } } else { for (int i = appWidgetIds.length - 1; i > -1; i--) { int[] tempappWidgetIds = {appWidgetIds[i]}; this.onUpdate(context, AppWidgetManager.getInstance(context), tempappWidgetIds); } } } } } else { super.onReceive(context, intent); } }
@Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); if (CLOCK_WIDGET_UPDATE.equals(intent.getAction())) { Bundle extras = intent.getExtras(); if (extras != null) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); ComponentName thisAppWidget = new ComponentName(context.getPackageName(), VerboseClockWidget.class.getName()); int[] appWidgetIds = appWidgetManager.getAppWidgetIds(thisAppWidget); onUpdate(context, appWidgetManager, appWidgetIds); } } else { Bundle extras = intent.getExtras(); if (extras != null) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); ComponentName thisAppWidget = new ComponentName(context.getPackageName(), VerboseClockWidget.class.getName()); int[] appWidgetIds = appWidgetManager.getAppWidgetIds(thisAppWidget); onUpdate(context, appWidgetManager, appWidgetIds); } } }
@Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); Utils.setContext(context); if (!LaunchManager.isWidgetEnabled()) { return; } if (intent.getAction() != null && intent.getAction().equals(ACTION_BUTTON_PRESS)) { if (WidgetManager.isWidgetTemporarilyVisible()) { // hide the widget again after tap WidgetManager.setWidgetTemporarilyVisible(false); updateMe(context); } long now = System.currentTimeMillis(); long diff = now - mLastTime; if (diff < TOUCH_INTERVAL) { mClicks++; } else { mClicks = 1; } mLastTime = now; if (WidgetManager.getTapCountToOpen() == mClicks) { PinActivity.launch(context); mClicks = 0; mLastTime = 0; } } }
@DSVerified @DSBan(DSCat.DROIDSAFE_INTERNAL) public static void modelBroadCastReceiver(BroadcastReceiver receiver) { if (mApplication != null) { receiver.setApplication(mApplication); // callback receiver if (receiver instanceof android.app.admin.DeviceAdminReceiver) { DeviceAdminReceiver ar = (DeviceAdminReceiver) receiver; Intent appIntent = mApplication.droidsafeGetIntent(); ar.onDisableRequested(context, appIntent); ar.onDisabled(context, appIntent); ar.onEnabled(context, appIntent); ar.onPasswordChanged(context, appIntent); ar.onPasswordExpiring(context, appIntent); ar.onPasswordFailed(context, appIntent); ar.onPasswordSucceeded(context, appIntent); } if (receiver instanceof android.appwidget.AppWidgetProvider) { AppWidgetProvider aw = (AppWidgetProvider) receiver; Intent appIntent = mApplication.droidsafeGetIntent(); aw.onReceive(context, appIntent); aw.onEnabled(context); aw.onDisabled(context); int[] appWidgetIds = new int[1]; appWidgetIds[0] = DSUtils.FAKE_INT; aw.onUpdate(context, AppWidgetManager.getInstance(context), appWidgetIds); aw.onDeleted(context, appWidgetIds); } } }
@Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); if (intent.getAction().equals(DATA_FETCHED)) { int appWidgetId = intent.getIntExtra( AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); RemoteViews remoteViews = updateWidgetListView(context, appWidgetId); // update and notify widget when data arrives appWidgetManager.updateAppWidget(appWidgetId, remoteViews); appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetId, R.id.stack_view); } if (intent.getAction().equals(TOAST_ACTION)) { // The click form the widget item is received here int appWidgetId = intent.getIntExtra( AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); int viewIndex = intent.getIntExtra(EXTRA_ITEM, 0); context.startActivity( new Intent(context, ShowImagesActivity.class) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK) .putExtra("click", "Clicked Movie is \n --- " + Constants.text[viewIndex])); } }
@Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals("android.appwidget.action.notify")) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); int appWidgetIds[] = appWidgetManager.getAppWidgetIds(new ComponentName(context, TimeTableProvider.class)); for (int i = 0; i < appWidgetIds.length; i++) { Intent svcIntent = new Intent(context, TimeTableWidget.class); svcIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]); svcIntent.setData(Uri.parse(svcIntent.toUri(Intent.URI_INTENT_SCHEME))); RemoteViews widget = new RemoteViews(context.getPackageName(), R.layout.widget_layout); widget.setRemoteAdapter(appWidgetIds[i], R.id.words, svcIntent); Intent clickIntent = new Intent(context, MainActivity.class); PendingIntent clickPI = PendingIntent.getActivity(context, 0, clickIntent, PendingIntent.FLAG_UPDATE_CURRENT); widget.setPendingIntentTemplate(R.id.words, clickPI); widget.setTextViewText(R.id.weekday, TimeTableControl.today()); appWidgetManager.updateAppWidget(appWidgetIds[i], widget); } appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.words); } super.onReceive(context, intent); }
@Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); if (intent.getAction().equalsIgnoreCase("com.nure.sigma.wimk.wimk.WIDGET_CLICK")) { Intent i = new Intent(context.getApplicationContext(), SOSService.class); context.getApplicationContext().startService(i); } }
@Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); if (CLICK_ACTION.equals(intent.getAction())) { Toast.show( context, new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINESE).format(new Date())); } }
@Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); this.onUpdate( context, appWidgetManager, appWidgetManager.getAppWidgetIds(new ComponentName(context, YambaWidget.class))); }
@Override public void onReceive(@NonNull Context context, @NonNull Intent intent) { super.onReceive(context, intent); if (MyFetchService.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); } }
@Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(OPEN_ACTIVITY_ACTION)) { Intent intent1 = new Intent(context, MainActivity.class); intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent1); } super.onReceive(context, intent); }
@Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); // receive intent and update widget content if (Constants.INTENT_WIDGET_UPDATE.equals(intent.getAction())) { Log.d(TAG, "Update widget intent received "); updateWidgetContent(context, AppWidgetManager.getInstance(context), null, null); } }
@Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); if (action.equals(FORCE_UPDATE) || action.equals(Intent.ACTION_TIMEZONE_CHANGED) || action.equals(Intent.ACTION_TIME_CHANGED)) { update(context); } super.onReceive(context, intent); }
@Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); if (intent.getAction().equals(ACTION_DATA_UPDATED)) { Log.d(TAG, "Received intent to update"); AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, getClass())); appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.widget_list); } }
@Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); if (intent.getAction().equals(ACTION_MYAPPWIDGET_DISPLAY)) { GregorianCalendar now = new GregorianCalendar(); SimpleDateFormat dateFormat = new SimpleDateFormat("EEE MMMM dd"); Toast.makeText(context, dateFormat.format(now.getTime()), Toast.LENGTH_LONG).show(); } }
@Override public void onReceive(Context ctx, Intent intent) { final String action = intent.getAction(); if (action.equals(Intent.ACTION_TIME_TICK)) { } else if (action.equals(CLICK)) { toggleApnStatus(ctx); updateWidget(ctx); } else { super.onReceive(ctx, intent); } }
// Called when the BroadcastReceiver receives an Intent broadcast. // Checks to see whether the intent's action is TOAST_ACTION. If it is, the app widget // displays a Toast message for the current item. @Override public void onReceive(Context context, Intent intent) { AppWidgetManager mgr = AppWidgetManager.getInstance(context); if (intent.getAction().equals(RUN_ACTION)) { int appWidgetId = intent.getIntExtra( AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); String extra = intent.getStringExtra(EXTRA_ITEM); Toast.makeText(context, "Touched view " + extra, Toast.LENGTH_SHORT).show(); } super.onReceive(context, intent); }
@Override public void onReceive(Context context, Intent intent) { // super.onReceive(context, intent); if (intent.getAction().equals("startup.nsn.yamba.NEW_STATUS")) { // Log.d(TAG, "onReceived detected new status update"); AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); // this.onUpdate( context, appWidgetManager, appWidgetManager.getAppWidgetIds(new ComponentName(context, YambaWidget.class))); // } }
@Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); if (action.equals(Sonet.ACTION_REFRESH)) { Sonet.acquire(context); // this should reload the widget int[] appWidgetIds; if (intent.hasExtra(AppWidgetManager.EXTRA_APPWIDGET_ID)) { appWidgetIds = new int[] { intent.getIntExtra( AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID) }; } else if (intent.hasExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS)) { appWidgetIds = intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS); } else { appWidgetIds = new int[] {AppWidgetManager.INVALID_APPWIDGET_ID}; } context.startService( new Intent(context, SonetService.class) .putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds) .setAction(action)); } else if (AppWidgetManager.ACTION_APPWIDGET_DELETED.equals(action)) { final int appWidgetId = intent .getExtras() .getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) { onDeleted(context, new int[] {appWidgetId}); } else { super.onReceive(context, intent); } } else { super.onReceive(context, intent); } }
@Override public void onReceive(Context context, Intent intent) { Log.d("FinancistoWidget", "onReceive intent " + intent); String action = intent.getAction(); if (WIDGET_UPDATE_ACTION.equals(action)) { int widgetId = intent.getIntExtra(WIDGET_ID, INVALID_APPWIDGET_ID); if (widgetId != INVALID_APPWIDGET_ID) { AppWidgetManager manager = AppWidgetManager.getInstance(context); updateWidgets(context, manager, new int[] {widgetId}, true); } } else { super.onReceive(context, intent); } }
// Called when the BroadcastReceiver receives an Intent broadcast. // Checks to see whether the intent's action is TOAST_ACTION. If it is, the app widget // displays a Toast message for the current item. @Override public void onReceive(Context context, Intent intent) { // AppWidgetManager mgr = AppWidgetManager.getInstance(context); if (intent.getAction().equals(FlavorContactsWidget.ACTION_TOAST)) { Integer contactId = intent.getIntExtra(FlavorContactsWidget.EXTRA_STRING, 0); if (contactId != 0) { Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, String.valueOf(contactId)); ContactsContract.QuickContact.showQuickContact( context, intent.getSourceBounds(), uri, ContactsContract.QuickContact.MODE_SMALL, null); } } super.onReceive(context, intent); }
@Override public void onReceive(final Context context, final Intent intent) { // This will hold the intent to redispatch final Intent redirect; if (intent.getAction().equals(ACTION_LAUNCH_BROWSER)) { redirect = buildRedirectIntent( Intent.ACTION_MAIN, AppConstants.ANDROID_PACKAGE_NAME, AppConstants.BROWSER_INTENT_CLASS_NAME, intent); Telemetry.sendUIEvent( TelemetryContract.Event.LAUNCH, TelemetryContract.Method.WIDGET, "browser"); } else if (intent.getAction().equals(ACTION_LAUNCH_NEW_TAB)) { redirect = buildRedirectIntent( Intent.ACTION_VIEW, AppConstants.ANDROID_PACKAGE_NAME, AppConstants.BROWSER_INTENT_CLASS_NAME, intent); Telemetry.sendUIEvent( TelemetryContract.Event.LAUNCH, TelemetryContract.Method.WIDGET, "new-tab"); } else if (intent.getAction().equals(ACTION_LAUNCH_SEARCH)) { redirect = buildRedirectIntent( Intent.ACTION_VIEW, AppConstants.SEARCH_PACKAGE_NAME, AppConstants.SEARCH_INTENT_CLASS_NAME, intent); Telemetry.sendUIEvent( TelemetryContract.Event.LAUNCH, TelemetryContract.Method.WIDGET, "search"); } else { redirect = null; } if (redirect != null) { try { context.startActivity(redirect); } catch (Exception ex) { // When this is built stand alone, its hardcoded to try and launch nightly. // If that fails, just fire a generic VIEW intent. Intent redirect2 = buildRedirectIntent(Intent.ACTION_VIEW, null, null, intent); context.startActivity(redirect2); } } super.onReceive(context, intent); }
@Override public void onReceive(android.content.Context context, Intent intent) { super.onReceive(context, intent); String action = intent.getAction(); if (TaskProvider.cUpdateIntent.equals(action) || ProjectProvider.cUpdateIntent.equals(action) || ContextProvider.cUpdateIntent.equals(action)) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); // Retrieve the identifiers for each instance of your chosen widget. ComponentName thisWidget = new ComponentName(context, WidgetProvider.class); int[] appWidgetIds = appWidgetManager.getAppWidgetIds(thisWidget); if (appWidgetIds != null && appWidgetIds.length > 0) { this.onUpdate(context, appWidgetManager, appWidgetIds); } } }
@Override public void onReceive(final Context context, Intent intent) { super.onReceive(context, intent); if (SYNC_CLICKED.equals(intent.getAction())) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); if (activeNetwork != null && activeNetwork.isConnected()) { getOpeningStatus(context); } else { Toast.makeText(context, "No connection available for refresh", Toast.LENGTH_SHORT).show(); } } }
// This fires when the OMC Service broadcasts the WIDGET_REFRESH intent. @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (AppWidgetManager.ACTION_APPWIDGET_DELETED.equals(action)) { Bundle extras = intent.getExtras(); int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) { this.onDeleted(context, new int[] {appWidgetId}); } } else { // Set time for output OMCWidgetDrawEngine.updateAppWidget(context, OMC.WIDGET2x1CNAME); super.onReceive(context, intent); } }
@Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); int appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, 0); AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); if (intent.getAction().equals(ACTION_UPDATE_ARRIVALS)) { WidgetProviderComponent component = DaggerWidgetProviderComponent.builder() .applicationComponent( ((AndroidApplication) context.getApplicationContext()).getApplicationComponent()) .widgetProviderModule(new WidgetProviderModule()) .build(); component.inject(this); executeArrivalsRequest(context, appWidgetManager, appWidgetId); } }
@Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); if (action.equals(Intent.ACTION_TIME_TICK) || action.equals(Intent.ACTION_TIME_CHANGED) || action.equals(Intent.ACTION_DATE_CHANGED) || action.equals(Intent.ACTION_TIMEZONE_CHANGED) || action.equals(Intent.ACTION_LOCALE_CHANGED)) { MonthViewWidgetService.updateMonthViewWidget(context); } else { super.onReceive(context, intent); return; } } catch (NullPointerException e) { initService(context); } }