android.appwidget.AppWidgetProvider.onReceive()方法的使用及代码示例

x33g5p2x  于11个月前 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(57)

本文整理了Java中android.appwidget.AppWidgetProvider.onReceive()方法的一些代码示例,展示了AppWidgetProvider.onReceive()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AppWidgetProvider.onReceive()方法的具体详情如下:
包路径:android.appwidget.AppWidgetProvider
类名称:AppWidgetProvider
方法名:onReceive

AppWidgetProvider.onReceive介绍

暂无

代码示例

代码示例来源:origin: naman14/Timber

@Override
public void onReceive(Context context, Intent intent) {
  String action = intent.getAction();
  if (action != null && action.startsWith("com.naman14.timber.")) {
    AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
    ComponentName thisAppWidget = new ComponentName(context.getPackageName(), this.getClass().getName());
    int[] appWidgetIds = appWidgetManager.getAppWidgetIds(thisAppWidget);
    onUpdate(context, appWidgetManager, appWidgetIds, intent.getExtras());
  } else {
    super.onReceive(context, intent);
  }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public void onReceive(Context context, Intent intent) {
 if (intent.getAction() == null) {
  updateWidget(context,
         AppWidgetManager.getInstance(context),
         intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
                  -1));
 }
 else {
  super.onReceive(context, intent);
 }
}

代码示例来源:origin: k9mail/k-9

@Override
public void onReceive(Context context, Intent intent) {
  super.onReceive(context, intent);
  String action = intent.getAction();
  if (action.equals(ACTION_UPDATE_MESSAGE_LIST)) {
    AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
    int[] appWidgetIds = intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS);
    appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.listView);
  }
}

代码示例来源:origin: ankidroid/Anki-Android

@Override
public void onReceive(Context context, Intent intent) {
  if (intent.getAction().contentEquals("com.sec.android.widgetapp.APPWIDGET_RESIZE")) {
    CompatHelper.getCompat().updateWidgetDimensions(context, new RemoteViews(context.getPackageName(), R.layout.widget_small), AnkiDroidWidgetSmall.class);
  }
  super.onReceive(context, intent);
}

代码示例来源:origin: hidroh/materialistic

@Override
public void onReceive(Context context, Intent intent) {
  if (TextUtils.equals(intent.getAction(), ACTION_REFRESH_WIDGET)) {
    int appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
        AppWidgetManager.INVALID_APPWIDGET_ID);
    new WidgetHelper(context).refresh(appWidgetId);
  } else if (TextUtils.equals(intent.getAction(), AppWidgetManager.ACTION_APPWIDGET_UPDATE)) {
    int[] appWidgetIds = intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS);
    if (appWidgetIds != null) {
      WidgetHelper widgetHelper = new WidgetHelper(context);
      for (int appWidgetId : appWidgetIds) {
        widgetHelper.configure(appWidgetId);
      }
    }
  } else {
    super.onReceive(context, intent);
  }
}

代码示例来源:origin: aa112901/remusic

super.onReceive(context, intent);

代码示例来源:origin: ukanth/afwall

@Override
public void onReceive(final Context context, final Intent intent) {
  super.onReceive(context, intent);
}

代码示例来源:origin: ukanth/afwall

@Override
public void onReceive(final Context context, final Intent intent) {
  super.onReceive(context, intent);
}

代码示例来源:origin: ukanth/afwall

@Override
public void onReceive(final Context context, final Intent intent) {
  super.onReceive(context, intent);
  if (Api.STATUS_CHANGED_MSG.equals(intent.getAction())) {

代码示例来源:origin: dialogflow/dialogflow-android-client

@Override
public void onReceive(final Context context, final Intent intent) {
  super.onReceive(context, intent);
  if (intent.getAction().equals(ACTION_KEY)) {
    final Intent popUpIntent = new Intent(context, AIWidgetActivity.class);
    popUpIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(popUpIntent);
    Toast.makeText(context.getApplicationContext(), "API.AI Dialog shown",Toast.LENGTH_SHORT).show();
  }
}

代码示例来源:origin: arminha/worldclockwidget

@Override
public void onReceive(Context context, Intent intent) {
  super.onReceive(context, intent);
  if (WIDGET_DATA_CHANGED_ACTION.equals(intent.getAction())
      || CLOCK_TICK_ACTION.equals(intent.getAction())) {
    PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    if (pm.isScreenOn()) {
      onClockTick(context);
    }
  }
}

代码示例来源:origin: pranavpandey/dynamic-support

@Override
public void onReceive(@NonNull Context context, @NonNull Intent intent)  {
  super.onReceive(context, intent);
  if (intent.getAction() != null && intent.getAction()
      .equals(AppWidgetManager.ACTION_APPWIDGET_UPDATE)) {
    AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
    int[] appWidgetIds = appWidgetManager.getAppWidgetIds(
        new ComponentName(context, getClass().getName()));
    onUpdate(context, appWidgetManager, appWidgetIds);
  }
}

代码示例来源:origin: Theoneee/DynamicWallpaper

@Override
public void onReceive(Context context, Intent intent) {
  final String action = intent.getAction();
  Log.e(TAG, "onReceive: " + action);
  if (action.equals(INTENT))
    updateAppWidget(context, AppWidgetManager.getInstance(context), idsSet);
  super.onReceive(context, intent);
}

代码示例来源:origin: fgl27/isu

@Override
public void onReceive(Context context, Intent intent) {
  super.onReceive(context, intent);
  if (ACTION_SU.equals(intent.getAction())) {
    Tools.SwitchSu(!Tools.SuBinary(), false, context);
  }
}

代码示例来源:origin: XFY9326/KeyBlocker

@Override
public void onReceive(Context context, Intent intent) {
  if (intent.getAction().equals(Config.APPWIDGET_CLICK_ACTION)) {
    BaseMethod.KeyLockBroadcast(context, false, false);
    updateView(context);
  } else if (intent.getAction().equals(Config.APPWIDGET_UPDATE_ACTION)) {
    reloadView(context, true);
  }
  super.onReceive(context, intent);
}

代码示例来源:origin: andstatus/andstatus

@Override
public void onReceive(Context context, Intent intent) {
  MyLog.i(this, "onReceive; action=" + intent.getAction());
  MyContextHolder.initialize(context, this);
  super.onReceive(context, intent);
}

代码示例来源:origin: fgl27/isu

@Override
public void onReceive(Context context, Intent intent) {
  super.onReceive(context, intent);
  if (ACTION_SU.equals(intent.getAction())) {
    Tools.SwitchSu(!Tools.SuBinary(), false, context);
  }
  if (ACTION_SELINUX.equals(intent.getAction())) {
    Tools.SwitchSelinux(!Tools.isSELinuxActive(context), context);
  }
}

代码示例来源:origin: byhieg/easyweather

@Override
public void onReceive(Context context, Intent intent) {
  // “更新”广播
  updateAllAppWidgets(context, AppWidgetManager.getInstance(context), idsSet);
  super.onReceive(context, intent);
}

代码示例来源:origin: fgl27/isu

@Override
public void onReceive(Context context, Intent intent) {
  super.onReceive(context, intent);
  if (ACTION_SU.equals(intent.getAction())) {
    Tools.SwitchSu(!Tools.SuBinary(), false, context);
  }
  if (ACTION_SELINUX.equals(intent.getAction())) {
    Tools.SwitchSelinux(!Tools.isSELinuxActive(context), context);
  }
}

代码示例来源:origin: retomeier/Wrox-ProfessionalAndroid-4E

@Override
public void onReceive(Context context, Intent intent){
 super.onReceive(context, intent);
 if (NEW_QUAKE_BROADCAST.equals(intent.getAction())) {
  PendingResult pendingResult = goAsync();
  AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
  ComponentName earthquakeWidget = new ComponentName(context, EarthquakeWidget.class);
  int[] appWidgetIds = appWidgetManager.getAppWidgetIds(earthquakeWidget);
  updateAppWidgets(context, appWidgetManager, appWidgetIds, pendingResult);
 }
}

相关文章