title: Android Firebase Push Notification not received
body: <p>I followed the tutorial from this link <a href="http://blog.nkdroidsolutions.com/android-push-notification-example-using-firebase/" rel="nofollow noreferrer">http://blog.nkdroidsolutions.com/android-push-notification-example-using-firebase/</a> but I am not not receiving any notification on my device.</p>
  
  <p>I checked and tried these links too, but could not find a solution 
  <a href="https://stackoverflow.com/questions/39120987/android-firebase-notification-push-notification-not-working">android - Firebase Notification Push Notification not working</a>
  <a href="https://stackoverflow.com/questions/22067859/push-notification-not-received-in-android">Push Notification not Received in android</a></p>
  
  <p>In my firebase console, the notification sent is 0. Here is my androidManifest File</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.example.ather.healthapp"&gt;
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.GET_ACCOUNTS" /&gt;
  &lt;uses-permission android:name="android.permission.USE_CREDENTIALS" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.WIFI" /&gt;
  &lt;uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&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;meta-data
          android:name="com.google.android.gms.version"
          android:value="@integer/google_play_services_version" /&gt;
  
      &lt;activity android:name=".MainActivity" /&gt;
      &lt;activity android:name=".LoginActivity" /&gt;
      &lt;activity android:name=".SplashScreen"&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;activity android:name=".SignUpScreen"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="com.example.ather.healthapp.SignUpScreen" /&gt;
  
              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  
  
  
      &lt;activity android:name=".LoginActivity_New" /&gt;
      &lt;activity android:name=".ActivityUserProfile" /&gt;
  
      &lt;meta-data
          android:name="com.google.android.geo.API_KEY"
          android:value="@string/google_maps_key" /&gt;
      &lt;meta-data
          android:name="com.google.android.gms.version"
          android:value="@integer/google_play_services_version" /&gt;
  
      &lt;activity
          android:name=".MapActivity"
          android:label="@string/title_activity_map" /&gt;
      &lt;activity android:name=".TestActivity" /&gt;
      &lt;activity android:name=".stDisplayListView" /&gt;
      &lt;activity android:name=".DoctorAppointment" /&gt;
      &lt;activity android:name=".todelete" /&gt;
      &lt;activity android:name=".TestGoogleSignIn" /&gt;
      &lt;activity android:name=".UserHistoryActivity" /&gt;
      &lt;activity android:name=".UserMedicineAndTestActivity" /&gt;
  
      &lt;service android:name="firebaseconnection.FirebaseIDService"
          android:enabled="true"
          android:exported="true"
          &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="firebaseconnection.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;activity android:name=".UserTestAndMedicine"&gt;&lt;/activity&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p></p>
  
  <p>The gradle file is as follows </p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  
  android {
  compileSdkVersion 24
  buildToolsVersion "24.0.0"
  
  defaultConfig {
      applicationId "com.example.ather.healthapp"
      minSdkVersion 15
      targetSdkVersion 24
      versionCode 1
      versionName "1.0"
  }
  buildTypes {
      release {
          minifyEnabled false
          proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      }
  
   }
  }
  
  dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  testCompile 'junit:junit:4.12'
  compile project(path: ':volley')
  repositories {
      mavenCentral()
  }
  // this line must be included to integrate with Firebase
  compile 'com.android.support:appcompat-v7:24.2.1'
  compile 'com.jakewharton:butterknife:8.1.0'
  compile 'com.google.android.gms:play-services-auth:9.6.1'
  compile 'com.google.android.gms:play-services:9.6.1'
  compile 'com.android.support:support-v4:24.2.1'
  compile 'com.sothree.slidinguppanel:library:3.0.0'
  compile 'com.android.support:design:24.2.1'
  compile 'com.google.firebase:firebase-core:9.6.1'
  compile 'com.google.firebase:firebase-messaging:9.6.1'
  }
  
  apply plugin: 'com.google.gms.google-services'
  </code></pre>
  
  <p>Firebase Messaging Service file</p>
  
  <pre><code>package FirebaseConnection;
  
  import android.util.Log;
  
  import com.google.firebase.messaging.RemoteMessage;
  public class FirebaseMessagingService extends      
  com.google.firebase.messaging.FirebaseMessagingService {
  private static final String TAG = "FCM Service";
  @Override
  public void onMessageReceived(RemoteMessage remoteMessage)
  {
      Log.d(TAG, "From: " + remoteMessage.getFrom());
  
      // Check if message contains a data payload.
      if (remoteMessage.getData().size() &gt; 0) {
          Log.d(TAG, "Message data payload: " + remoteMessage.getData());
      }
  
      // Check if message contains a notification payload.
      if (remoteMessage.getNotification() != null) {
          Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody());
      }
  
  }
  
  }
  </code></pre>
  
  <p>And the Firebase ID Service</p>
  
  <pre><code>package FirebaseConnection;
  
  import android.util.Log;
  
  import com.google.firebase.iid.FirebaseInstanceId;
  import com.google.firebase.iid.FirebaseInstanceIdService;
  
  public class FirebaseIDService extends FirebaseInstanceIdService {
  private static final String TAG = "FirebaseIDService";
  
  @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.
      sendRegistrationToServer(refreshedToken);
  }
  
  /**
   * Persist token to third-party servers.
   *
   * Modify this method to associate the user's FCM InstanceID token with any server-side account
   * maintained by your application.
   *
   * @param token The new token.
   */
  private void sendRegistrationToServer(String token) {
      // Add custom implementation, as needed.
  }
  }
  </code></pre>
  
  <p>Any help would be appreciated. </p>
  
  <p>Regards</p>