title: android - Firebase Notification Push Notification not working
body: <p><strong>UPDATE</strong></p>
  
  <blockquote>
    <p><em>Unfortunately, I didn't solve this issue and what I did is create a new project. Fortunately my new project works. One thing I noticed
    from my newly created project, when I am sending notification
    messages, some messages didn't arrive to my device. So I think its my
    Internet connection problem (my idea only).</em></p>
  </blockquote>
  
  <p>I am trying to implement basic receiving of Push Notifications using Firebase. I based this tutorial:</p>
  
  <p><a href="https://www.codementor.io/android/tutorial/send-push-notifications-to-android-with-firebase" rel="nofollow">https://www.codementor.io/android/tutorial/send-push-notifications-to-android-with-firebase</a></p>
  
  <p>My Problem is I don't receive any messages at all. I have sent more than 5 messages using the Firebase Console and still nothing happens. </p>
  
  <p>Here is my implementation of FirebaseInstanceIdService:</p>
  
  <pre><code>public class MyFirebaseInstanceIdService extends FirebaseInstanceIdService {
  
  public static final String debugTag = "MyFirebaseIIDService";
  
  @Override
  public void onTokenRefresh() {
      super.onTokenRefresh();
  
      //Getting registration token
      String refreshedToken = FirebaseInstanceId.getInstance().getToken();
  
      //Displaying token in logcat
      Log.e(debugTag, "Refreshed token: " + refreshedToken);
  
  }
  
  private void sendRegistrationToServer(String token) {
      //You can implement this method to store the token on your server
      //Not required for current project
  }
  
  }
  </code></pre>
  
  <p>My FirebaseMessagingService implementation:</p>
  
  <pre><code>public class MyFirebaseMessagingService extends FirebaseMessagingService {
  
  public static final String debugTag = "MyFirebaseApp";
  
  @Override
  public void onMessageReceived(RemoteMessage remoteMessage) {
      super.onMessageReceived(remoteMessage);
  
      Log.d(debugTag, "Notification Received!");
  
      //Calling method to generate notification
      sendNotification(remoteMessage.getNotification().getTitle(),remoteMessage.getNotification().getBody());
  
  }
  
  //This method is only generating push notification
  private void sendNotification(String title, String messageBody) {
      Intent intent = new Intent(this, MainActivity.class);
      intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
      PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent,
              PendingIntent.FLAG_ONE_SHOT);
  
      Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
      NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
              .setSmallIcon(R.mipmap.ic_launcher)
              .setContentTitle(title)
              .setContentText(messageBody)
              .setAutoCancel(true)
              .setSound(defaultSoundUri)
              .setContentIntent(pendingIntent);
  
      NotificationManager notificationManager =
              (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
  
      notificationManager.notify(0, notificationBuilder.build());
  }
  
  }
  </code></pre>
  
  <p>My Manifest file:</p>
  
  <p></p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  
  &lt;application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:supportsRtl="true"
      android:theme="@style/AppTheme"&gt;
      &lt;activity android:name=".activities.MainActivity"&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;/activity&gt;
  
      &lt;service
          android:name=".messagingservice.MyFirebaseMessagingService"
          android:enabled="true"
          android:exported="true"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="com.google.firebase.MESSAGING_EVENT" /&gt;
          &lt;/intent-filter&gt;
      &lt;/service&gt;
  
      &lt;service android:name=".tokenservice.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;
  </code></pre>
  
  <p></p>
  
  <p>What am I doing wrong? Or what am I lacking to implement? </p>
  
  <p>I am really needing some help with this one. Any help will be greatly appreciated. Thank you very much!</p>