title: onMessageRecieved never fired Firebase notifications
body: <p>my on MessageRecieved method never gets fired in my Android app although the service is running and the manifest seems to be fine. We are sending messages through the firebase console and nothing ever seems to happen. Also the onToken refresh method is only ever called once and that is when you first install the application. After that, it is never called. I have tested the app in the foreground and background and still the onMessageRecieve method is not called. </p>
  
  <p>Here is my manifest</p>
  
  <pre><code>        &lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          package="com.example.beatrice.mylocalbartender"&gt;
  
          &lt;application
              android:allowBackup="true"
              android:icon="@mipmap/ic_launcher"
              android:label="@string/app_name"
              android:supportsRtl="true"
              android:theme="@style/AppTheme"
              tools:node="replace"
              tools:replace="android:supportsRtl"&gt;
  
              &lt;!-- meta data to connect ot the facebook api --&gt;
  
              &lt;service
                  android:enabled="true"
                  android:exported="true"
                  android:name=".messaging.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;service
                  android:enabled="true"
                  android:exported="true"
                  android:name=".messaging.MyFirebaseMessagingService"&gt;
                  &lt;intent-filter&gt;
                      &lt;action android:name="com.google.firebase.MESSAGING_
      EVENT"/&gt;
                  &lt;/intent-filter&gt;
              &lt;/service&gt;
  
  
              &lt;meta-data
                  android:name="com.google.firebase.messaging.default_notification_icon"
                  android:resource="@drawable/bt_ic_android_pay" /&gt;
              &lt;!-- Set color used with incoming notification messages. This is used when no color is set for the incoming
                   notification message.  for more. --&gt;
              &lt;meta-data
                  android:name="com.google.firebase.messaging.default_notification_color"
                  android:resource="@color/colorAccent" /&gt;
  
  
              &lt;meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/&gt;
              &lt;meta-data android:name="com.google.android.gms.wallet.api.enabled" android:value="true"/&gt;
              &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /&gt;
  
  
  
  
              &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  
              &lt;activity android:name=".messaging.MainActivity"&gt;&lt;/activity&gt;
              &lt;activity android:name=".activity.GmailSignInActivity"&gt;
  
              &lt;/activity&gt;
  
              &lt;activity android:name=".activity.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;!-- activity for brain tree, please do not touch --&gt;
              &lt;activity
                  android:name="com.braintreepayments.api.BraintreeBrowserSwitchActivity"
                  android:launchMode="singleTask"&gt;
                  &lt;intent-filter&gt;
                      &lt;action android:name="android.intent.action.VIEW" /&gt;
  
                      &lt;category android:name="android.intent.category.DEFAULT" /&gt;
                      &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
  
                      &lt;data android:scheme="${applicationId}.braintree" /&gt;
                  &lt;/intent-filter&gt;
              &lt;/activity&gt;
  
              &lt;!-- This activity will be removed in the future --&gt;
  
              &lt;activity
                  android:name=".activity.FacebookLogInActivity"
                  android:label="@string/title_activity_facebook_log_in"
                  android:theme="@style/AppTheme.NoActionBar"&gt;
  
              &lt;/activity&gt;
  
  
              &lt;!-- to launch facebook activity - please do not touch --&gt;
  
              &lt;activity android:name="com.facebook.FacebookActivity"
                  android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
                  android:theme="@android:style/Theme.Translucent.NoTitleBar"
                  android:label="@string/app_name" /&gt;
  
              &lt;activity enter code hereandroid:name="com.braintreepayments.api.dropin.DropInActivity"&gt;&lt;/activity&gt;
              &lt;activity android:name="com.braintreepayments.api.dropin.AddCardActivity"&gt;&lt;/activity&gt;
  
  
  
          &lt;/application&gt;
  
      &lt;/manifest&gt;
  </code></pre>
  
  <p>As you can see the services are enabled and exported. 
   Here are the services</p>
  
  <pre><code>public class MyFirebaseInstanceIdService extends FirebaseInstanceIdService {
  
      private static final String TAG = "MyFirebaseIIDService";
      private static final String FRIENDLY_ENGAGE_TOPIC = "friendly_engage";
  
      /**
       * The Application's current Instance ID token is no longer valid
       * and thus a new one must be requested.
       */
  
      public MyFirebaseInstanceIdService(){
          super();
          Log.d("startedServiceNoLie","hiiiiiiiiiiiiiiiiiiiii");
      }
  
  
      @Override
      public void onTokenRefresh() {
          // If you need to handle the generation of a token, initially or
          // after a refresh this is where you should do that.
          String token = FirebaseInstanceId.getInstance().getToken();
  
          Log.d(TAG, "FCM Token: " + token);
      }
  }
  </code></pre>
  
  <p>And this is the FirebaseMessagingService</p>
  
  <pre><code>public class MyFirebaseMessagingService extends FirebaseMessagingService {
  
      private static final String TAG = "MyFMService";
  
      public MyFirebaseMessagingService() {
          super();
          Log.d("startedMessageRecieved","messagingService");
  
      }
  
      @Override
      public void onMessageReceived(RemoteMessage remoteMessage) {
          // Handle data payload of FCM messages.
          Log.d("messageRecieved", "FCM Message Id: " + remoteMessage.getMessageId());
          Log.d("messageRecieved", "FCM Notification Message: " +
                  remoteMessage.getNotification());
          Log.d("messageRecieved", "FCM Data Message: " + remoteMessage.getData());
      }
  }
  </code></pre>
  
  <p>And this is the activity from where is both services are being called from </p>
  
  <pre><code>    public class MainActivity extends AppCompatActivity {
  
      Button launch_msg_app;
     // private static DatabaseReference root = FirebaseDatabase.getInstance().getReference();
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
  
          FirebaseApp.initializeApp(this);
          super.onCreate(savedInstanceState);
          setContentView(R.layout.deletethislayout);
  
          Intent intent = new Intent(this, MyFirebaseInstanceIdService.class);
  
          Log.d("tokenNotRefresh",FirebaseInstanceId.getInstance().getToken());
          startService(intent);
  
  
          startService(new Intent(this, MyFirebaseMessagingService.class));
  
          //startService(new Intent(this, DeleteService.class));
      }
  </code></pre>
  
  <p>Here is my project . gradle</p>
  
  <pre><code>buildscript {
      repositories {
          jcenter()
          maven { url 'https://maven.fabric.io/public' }
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:2.2.3'
          classpath 'com.google.gms:google-services:3.0.0'
          // NOTE: Do not place your application dependencies here; they belong
          // in the individual module build.gradle files
      }
  }
  
  allprojects {
      repositories {
          jcenter()
          mavenLocal()
          maven {
              url 'https://maven.fabric.io/public'
          }
      }
  }
  
  task clean(type: Delete) {
      delete rootProject.buildDir
  }
  </code></pre>
  
  <p>Here is my app .gradle </p>
  
  <pre><code>    apply plugin: 'com.android.application'
  
      repositories {
          mavenLocal()
          flatDir {
              dirs 'libs'
          }
      }
      android {
          compileSdkVersion 25
          buildToolsVersion "25.0.2"
  
          defaultConfig {
              applicationId "com.example.beatrice.mylocalbartender"
              minSdkVersion 16
              targetSdkVersion 25
              versionCode 1
              versionName "1.0"
              testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
          }
          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 'com.google.android.gms:play-services:10.2.0'
  
          compile 'com.android.support:design:25.0.0'
          compile 'com.github.bumptech.glide:glide:3.6.1'
          compile 'de.hdodenhof:circleimageview:1.3.0'
          compile 'com.android.support:appcompat-v7:25.0.0'
  
          // Google
          compile 'com.google.android.gms:play-services-auth:10.2.0'
  
          // Firebase
          compile 'com.google.firebase:firebase-core:10.2.0'
          compile 'com.google.firebase:firebase-messaging:10.2.0'
          compile 'com.google.firebase:firebase-database:10.0.0'
          compile 'com.google.firebase:firebase-auth:10.0.0'
          compile 'com.google.firebase:firebase-config:10.0.0'
          compile 'com.google.android.gms:play-services-appinvite:10.2.0'
          compile 'com.google.android.gms:play-services-ads:10.2.0'
          compile 'com.google.firebase:firebase-crash:10.0.0'
          compile 'com.google.firebase:firebase-appindexing:10.0.0'
  
          // Payments
          compile 'com.firebaseui:firebase-ui-database:0.4.0'
          compile 'com.braintreepayments.api:drop-in:3.+'
          compile 'com.loopj.android:android-async-http:1.4.9'
          compile 'com.google.android.gms:play-services-auth:10.2.0'
          compile 'com.facebook.android:facebook-android-sdk:4.+'
          compile 'com.google.android.gms:play-services-wallet:10.2.0'
          compile 'com.firebase:geofire-android:2.1.1'
  
      }
  
  apply plugin: 'com.google.gms.google-services'
  </code></pre>
  
  <p>This is driving us crazy and I do not know why it does not receive a message. Again we are sending messages from the firebase notification console. We have a sent a message to the whole application and it still does nothing. Please help us. Thank you so much. </p>