title: How to enable Firebase after setting "firebase_messaging_auto_init_enabled" to "false" and retrieve a token/push messages
body: <p>I have a problem receiving any tokens or push notifications with my custom FirebaseMessagingService, after i disabled the auto initialisation of firebase messaging by setting the key <code>firebase_messaging_auto_init_enabled</code> to <code>false</code> in my AndroidManifest.xml.</p>
  
  <p>When not setting the key to <code>false</code> my Service does receive a token.
  I mean it is obvious, that i do need to initialise firebase messaging in order to retrieve a token, but all methods i tried did not seems to work.</p>
  
  <p>In order to prevent legal problems i only want to enable firebase/server communication after the user of my Android app did accept the terms of use.
  That is why i want to prevent the auto initialisation. After the user did accept the terms of use i want initialise the app and send my retrieved token to my backend.</p>
  
  <p>Methods i already tried:</p>
  
  <p><code>FirebaseApp.initializeApp(&lt;Context&gt;)</code>
  <code>FirebaseMessaging.getInstance().setAutoInitEnabled(true)</code></p>
  
  <p>I can actually get a token by using the method <code>FirebaseInstanceId.getInstance().getInstance()</code> but i would really prefer to use my FirebaseMessagingService which seems to be the much cleaner way.</p>
  
  <p>Here is some of the code in my AndroidManifest:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"&gt;
      &lt;application
      android:usesCleartextTraffic="true"&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;
      &lt;service
          android:name="de.itkl.smartmobile.module.push.implementation.SMPushMessageService"
              android:exported="false"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.google.firebase.INSTANCE_ID_EVENT" /&gt;
                  &lt;action android:name="com.google.firebase.MESSAGING_EVENT"/&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>