コード例 #1
0
  /**
   * Sends the registration ID to your server over HTTP, so it can use GCM/HTTP or CCS to send
   * messages to your app. Not needed for this demo since the device sends upstream messages to a
   * server that echoes back the message using the 'from' address in the message.
   */
  private void sendRegistrationIdToBackend() {
    // Your implementation here.
    Log.d("PLAY_ID", regid);

    Donnees.jeton = regid;
    JetonManager jm = new JetonManager(this.activity);
    jm.setJeton(regid);
  }
コード例 #2
0
  public void enregistrerCloudMessaginClient() {
    // Check device for Play Services APK. If check succeeds, proceed with
    //  GCM registration.
    if (checkPlayServices()) {
      gcm = GoogleCloudMessaging.getInstance(activity);
      regid = getRegistrationId(context);
      Log.e(TAG, "regid :" + regid);

      if (regid.length() == 0) {
        registerInBackground();
      } else {
        Donnees.jeton = regid;
        JetonManager jm = new JetonManager(this.activity);
        jm.setJeton(regid);
      }
    } else {
      Log.i("PLAY", "No valid Google Play Services APK found.");
    }
  }