code: private String GCMGetFreshToken(final String senderID) {
          getConfigLogger().verbose(getAccountId(), "GcmManager: Requesting a GCM token for Sender ID - " + senderID);
          String token = null;
          try {
              token = InstanceID.getInstance(context)
                      .getToken(senderID, GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
              getConfigLogger().info(getAccountId(), "GCM token : " + token);
          } catch (Throwable t) {
              getConfigLogger().verbose(getAccountId(), "GcmManager: Error requesting GCM token", t);
          }
          return token;
      }
docs: request token from GCM