Ejemplo n.º 1
0
 /*
  * Sends the pushbundle extras to the client application.
  * If the client application isn't currently active, it is cached for later processing.
  */
 public static void sendExtras(Bundle extras) {
   if (extras != null) {
     if (gWebView != null) {
       sendEvent(convertBundleToJson(extras));
     } else {
       Log.v(LOG_TAG, "sendExtras: caching extras to send at a later time.");
       gCachedExtras = extras;
     }
   }
 }
  @Override
  public void onRegistered(Context context, String regId) {

    Log.v(LOG_TAG, "onRegistered: " + regId);

    try {
      JSONObject json = new JSONObject().put(REGISTRATION_ID, regId);

      Log.v(LOG_TAG, "onRegistered: " + json.toString());

      PushPlugin.sendEvent(json);
    } catch (JSONException e) {
      // No message to the user is sent, JSON failed
      Log.e(LOG_TAG, "onRegistered: JSON exception");
    }
  }