title: Is it normal that my function onNewToken is never called?
body: <p>I followed the firebase procedure in order to implement my firebase notification with cloud messaging but it is not working</p>
  
  <p>My log in the onNewToken() function is never called </p>
  
  <p>I have the version 19.0.1 for com.google.firebase:firebase-messaging:19.0.1 and 17.0.1 for com.google.firebase:firebase-core:17.0.1</p>
  
  <p>I tried to take the token manually with this :</p>
  
  <pre><code>FirebaseInstanceId.getInstance().instanceId.addOnSuccessListener {
              sendTokenNotification(it.token)
          }
  </code></pre>
  
  <p>But with this, the notification I = s never send in the background... Only when I open my App</p>
  
  <p>In my AndroidManifest, I have</p>
  
  <pre><code>&lt;service
              android:name="library.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/logo" /&gt;
          &lt;meta-data
              android:name="com.google.firebase.messaging.default_notification_color"
              android:resource="@color/colorAccent" /&gt;
          &lt;meta-data
              android:name="firebase_messaging_auto_init_enabled"
              android:value="false" /&gt;
          &lt;meta-data
              android:name="firebase_analytics_collection_enabled"
              android:value="false" /&gt;
  </code></pre>
  
  <p>In my MainActivity, I have in my onCreate </p>
  
  <pre><code>FirebaseInstanceId.getInstance().instanceId
                  .addOnCompleteListener(OnCompleteListener { task -&gt;
                      if (!task.isSuccessful) {
                          Log.w("NEW_TOKEN", "getInstanceId failed", task.exception)
                          return@OnCompleteListener
                      }
  
                      // Get new Instance ID token
                      val token = task.result?.token
  
                      // Log and toast
                      val msg = getString(R.string.msg_token_fmt, token)
                      Log.d("NEW_TOKEN", msg)
                  })
  
          FirebaseMessaging.getInstance().isAutoInitEnabled = true
  </code></pre>
  
  <p>And in my MyFirebaseMessagingService I have :</p>
  
  <pre class="lang-java prettyprint-override"><code> @Override
      public void onMessageReceived(RemoteMessage remoteMessage) {
          Log.d("", "From: " + remoteMessage.getFrom());
          if(remoteMessage.getNotification() != null) {
              Log.d("", "Notification Message Body: " + remoteMessage.getNotification().getBody());
              createNotification(remoteMessage.getNotification().getTitle(), remoteMessage.getNotification().getBody());
          }
      }
      @Override
      public void onNewToken(String s) {
          super.onNewToken(s);
          Log.v("NEW_TOKEN",s);
  
          sendTokenNotification(s);
      }
  </code></pre>
  
  <p>And it never shows the Log in my onNewToken()</p>
  
  <p>I don't have any error it's just not entering my function</p>
  
  <p>So I was wondering if I do something wrong ... </p>
  
  <p>(I don't know if it can be this but my MainActivity is in Kotlin and my FirebaseMessagingService in java)</p>