title: Not getting refreshed token firebase android
body: <p>I have trouble in getting refreshed token in firebase. I have gone through documentation and followed the steps fro android exactly. In my log I find firebase connection as successful. Not sure why I am not getting the instance token. I am in initial stage and trying to get the token in logcat. </p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.project.application"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="9"
          android:targetSdkVersion="17" /&gt;
  
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="android.permission.GET_ACCOUNTS" /&gt;
  
      &lt;uses-permission android:name="android.permission.VIBRATE" /&gt;
      &lt;uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /&gt;
  
      &lt;application
          android:allowBackup="false"
          android:icon="@drawable/icon"
          android:label="@string/app_name" &gt;
          &lt;activity
              android:name=".ProjectName"
              android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
              android:icon="@drawable/icon"
              android:label="@string/app_name"
              android:theme="@android:style/Theme.Light.NoTitleBar"&gt; 
  
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
              &lt;meta-data
                  android:name="com.google.android.gms.version"
                  android:value="@integer/google_play_services_version" /&gt;
          &lt;/activity&gt;
  
          &lt;service
              android:name=".MyInstanceIDListenerService"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.google.firebase.INSTANCE_ID_EVENT" /&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
  
          &lt;service
              android:name=".MyFirebaseInstanceIDService"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.google.firebase.INSTANCE_ID_EVENT"/&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;       
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  
      public class MyInstanceIDListenerService  extends FirebaseInstanceIdService{    
      private static final String TAG = "MyFirebaseIIDService";
      @Override
      public void onTokenRefresh() {
          // Get updated InstanceID token.
          String refreshedToken = FirebaseInstanceId.getInstance().getToken();
  
          Log.d(TAG, "Refreshed token: " + refreshedToken);
          sendRegistrationToServer(refreshedToken);
  
      }
  
   public class MyFirebaseMessagingService extends FirebaseMessagingService {
  
  private static final String TAG = "MyFirebaseMsgService";
  @Override
  public void onMessageReceived(RemoteMessage remoteMessage) {
      // TODO(developer): Handle FCM messages here.
  
      Log.d(TAG, "From: " + remoteMessage.getFrom());
      String messageBody = null;
  
      // Check if message contains a data payload.
      if (remoteMessage.getData().size() &gt; 0) {
          Log.d(TAG, "Message data payload: " + remoteMessage.getData());
      }
  
      if (remoteMessage.getNotification() != null) {
          messageBody = remoteMessage.getNotification().getBody();
          Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody());
      }
  
      sendNotification(messageBody);
  
  }
  private void sendNotification(String messageBody) {
      Intent intent = new Intent(this, SplashActivity.class);
      intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
      PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
              PendingIntent.FLAG_ONE_SHOT);
  
      Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
      NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
              .setSmallIcon(R.drawable.ic_stat_ic_notification)
              .setContentTitle("FCM Message")
              .setContentText(messageBody)
              .setAutoCancel(true)
              .setSound(defaultSoundUri)
              .setContentIntent(pendingIntent);
  
      NotificationManager notificationManager =
              (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
  
      notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
  }
  </code></pre>
  
  <p>}</p>