title: Android - Firebase push notification not working
body: <p>I have created and setup Firebase console completely as Google tutorial mentioned. I have implemented Services in my project as well. While I am sending the message from Firebase console it is not receiving in my app. When I am trying to send using the single device then it is showing "Unregistered registration token".</p>
  
  <p>Here is my MyFirebaseInstanceIDService:</p>
  
  <pre><code>public class MyFirebaseInstanceIDService extends FirebaseInstanceIdService {
  
      @Override
      public void onTokenRefresh() {
  
          //Getting registration token
          String refreshedToken = FirebaseInstanceId.getInstance().getToken();
          System.out.println("TOKEN::" + refreshedToken);
          //Displaying token on logcat
  
          SmartApplication.REF_SMART_APPLICATION.writeSharedPreferences("regId", refreshedToken);
  //        SharedPreferences pref = getApplicationContext().getSharedPreferences(Config.SHARED_PREF, 0);
  //        SharedPreferences.Editor editor = pref.edit();
  //        editor.putString("regId", refreshedToken);
  //        editor.commit();
      }
  }
  </code></pre>
  
  <p>Here is my MyFirebaseMessagingService:</p>
  
  <pre><code>public class MyFirebaseMessagingService extends FirebaseMessagingService {
  
      private static final String TAG = "MyFirebaseMsgService";
      private static int count = 0;
      String TYPE = "type";
  
      @Override
      public void onMessageReceived(RemoteMessage remoteMessage) {
          //Displaying data in log
          //It is optional
          System.out.println("data getting");
          Log.d(TAG, "Notification Message TITLE: " + remoteMessage.getNotification().getTitle());
          Log.d(TAG, "Notification Message BODY: " + remoteMessage.getNotification().getBody());
          Log.d(TAG, "Notification Message DATA: " + remoteMessage.getData().toString());
  
          //Calling method to generate notification
          //remoteMessage.getNotification().getBody()
          sendNotification(remoteMessage.getNotification().getTitle(),
                  remoteMessage.getNotification().getBody(), remoteMessage.getData());
      }
  
  
      //This method is only generating push notification
      //It is same as we did in earlier posts
      private void sendNotification(String messageTitle, String messageBody, Map&lt;String, String&gt; row) {
          PendingIntent contentIntent = null;
          try {
              Intent groupDetailIntent = new Intent(this, UnanimousHomeActivity.class);
  
              contentIntent = PendingIntent.getActivity(this, (int) (Math.random() * 100),
                      groupDetailIntent, PendingIntent.FLAG_UPDATE_CURRENT);
          } catch (Exception e) {
              e.printStackTrace();
          }
          Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
          NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
                  .setSmallIcon(R.mipmap.ic_launcher)
                  .setContentTitle(messageTitle)
                  .setContentText(messageBody)
                  .setAutoCancel(true)
                  .setSound(defaultSoundUri)
                  .setContentIntent(contentIntent);
  
          NotificationManager notificationManager =
                  (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
          notificationManager.notify(count, notificationBuilder.build());
          count++;
      }
  }
  </code></pre>
  
  <p>I have stucked since 4 days, please someone help me out as no logical problem found here, some unusual things are happening while integration push. </p>