title: FirebaseInstanceId.getInstance().getToken() is generating two different types of token
body: <p>I am using the code below to generate FCM Registration token for implementing device-to-device push notification service.</p>
  
  <pre><code>@Override
  public void onTokenRefresh() {
      // Get updated InstanceID token.
      String refreshedToken = FirebaseInstanceId.getInstance().getToken();
      Log.d(TAG, "Refreshed token: " + refreshedToken);
  
      // TODO: Implement this method to send any registration to your app's servers.
      saveRegistrationToLocalStorage(refreshedToken);
  }
  </code></pre>
  
  <p>The code generates two different kinds of token. One with 152 characters and the other with 140 characters (Have tried more than 40-50 times, the generated token has either 140 or 152 characters). The tokens are used for device-to-device push notification using POST method.</p>
  
  <p>Token with 140 characters - works with firebase console, but <strong>not from device's POST method</strong> to catch a push notification.</p>
  
  <p>Token with 152 characters - works fine both with firebase console and device's POST method to catch a push notification.</p>
  
  <p><strong>The questions are:</strong></p>
  
  <ol>
  <li>Is a token with 140 character a normal one in FCM? Or is it unusual?</li>
  <li>If it is a normal one, why it is unable to catch a push notification? (There is absolutely no problem with a token with 152 characters) </li>
  <li>If 140 is a unusual size of a token, what I can do to produce a 152
  size in every installation?</li>
  </ol>
  
  <p>You can have a look at the POST method I am using:</p>
  
  <pre><code>private class sendPushNotification extends AsyncTask&lt;PushNotificationParams, Void, Void&gt;  {
      @Override
      protected Void doInBackground(PushNotificationParams... params) {
          String device_token = params[0].device_token;
          String notification_body = params[0].notification_body;
          String notification_title = params[0].notification_title;
          String authKey = "AIzaSy.......Xz4";   // FCM AUTH KEY
          String FCMurl = "https://fcm.googleapis.com/fcm/send";
  
          try{
              URL url = new URL(FCMurl);
              HttpURLConnection conn = (HttpURLConnection) url.openConnection();
  
              conn.setUseCaches(false);
              conn.setDoInput(true);
              conn.setDoOutput(true);
  
              conn.setRequestMethod("POST");
              conn.setRequestProperty("Authorization","key="+authKey);
              conn.setRequestProperty("Content-Type","application/json");
  
              //custom data
              Map&lt;String, String&gt; data = new HashMap&lt;String, String&gt;();
              data.put("data_1",data_1);
              data.put("data_2", data_2);
              data.put("data_3", data_3);
              data.put("title", notifcation_title);   // Notification title
              data.put("body", notification_body); // Notification body
              JSONObject map_data = new JSONObject(data);
              //custom data ends here
  
              JSONObject json = new JSONObject();
              json.put("to", device_token.trim());
              JSONObject info = new JSONObject();
              json.put("data", map_data); 
  
              OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
              wr.write(json.toString());
              wr.flush();
              conn.getInputStream();
  
          } catch (Exception e){
              Log.e("Response","from http push", e);
  
          }
  
          return null;
      }
  }
  </code></pre>