Пример #1
0
  @Override
  public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);

    Log.i(
        TAG,
        "---------------- initialize"
            + "-"
            + JPushPlugin.openNotificationAlert
            + "-"
            + JPushPlugin.notificationAlert);

    shouldCacheMsg = false;

    // 如果同时缓存了打开事件openNotificationAlert 和 消息事件notificationAlert,只向UI 发 打开事件。
    // 这样做是为了和iOS 统一
    if (JPushPlugin.openNotificationAlert != null) {
      JPushPlugin.notificationAlert = null;
      JPushPlugin.transmitOpen(
          JPushPlugin.openNotificationAlert, JPushPlugin.openNotificationExtras);
    }
    if (JPushPlugin.notificationAlert != null) {
      JPushPlugin.transmitReceive(JPushPlugin.notificationAlert, JPushPlugin.notificationExtras);
    }

    // JPushInterface.init(cordova.getActivity().getApplicationContext());
  }
  @Override
  public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);
    // JPushInterface.setDebugMode(true);

    // JPushPlugin.notificationAlert = alert;
    // JPushPlugin.notificationExtras = extras;
    if (JPushPlugin.openNotificationAlert != null) {
      JPushPlugin.transmitOpen(
          JPushPlugin.openNotificationAlert, JPushPlugin.openNotificationExtras);
    }
    if (JPushPlugin.notificationAlert != null) {
      JPushPlugin.transmitReceive(JPushPlugin.notificationAlert, JPushPlugin.notificationExtras);
    }

    // JPushInterface.init(cordova.getActivity().getApplicationContext());
  }
Пример #3
0
  public void onResume(boolean multitasking) {
    shouldCacheMsg = false;
    Log.i(
        TAG,
        "---------------- onResume"
            + "-"
            + JPushPlugin.openNotificationAlert
            + "-"
            + JPushPlugin.notificationAlert);

    if (JPushPlugin.openNotificationAlert != null) {
      JPushPlugin.notificationAlert = null;
      JPushPlugin.transmitOpen(
          JPushPlugin.openNotificationAlert, JPushPlugin.openNotificationExtras);
    }
    if (JPushPlugin.notificationAlert != null) {
      JPushPlugin.transmitReceive(JPushPlugin.notificationAlert, JPushPlugin.notificationExtras);
    }
  }