title: How to specify Android notification channel for FCM push messages in Android 8
body: <p>Our app now has <code>targetSdkVersion 26</code> (Android 8) and the app uses FCM push notifications.</p>
  
  <p>As <a href="https://firebase.google.com/docs/cloud-messaging/android/client" rel="noreferrer">FCM documentation</a> prescribes I updated the FCM client library to version 11.2.0:</p>
  
  <pre><code>dependencies {
       compile 'com.google.firebase:firebase-messaging:11.2.0'
  }
  </code></pre>
  
  <p>With this FCM client library update the FCM notifications started to appear on Android devices. Good, but when app is in background it's system who processes the FCM message, so it uses the default Android notification channel named "Miscellaneous", which is not what we want (we have other notification channels and "Miscellaneous" sounds confusing in that list).</p>
  
  <p>As <a href="https://firebase.google.com/docs/cloud-messaging/android/client" rel="noreferrer">FCM documentation</a> says there is a way to specify default notification channel for FCM messages:</p>
  
  <blockquote>
    <p>(Optional) Within the application component, metadata elements to set
    a default icon, color and <strong>notification channel</strong> (new in Android O) for
    notifications. Android uses these values whenever incoming messages do
    not explicitly set icon, color or <strong>notification_channel</strong>.</p>
  </blockquote>
  
  <p>However there is no code sample shown (samples are shown only for icon and color). So I just found by googling a sample in <a href="https://github.com/firebase/quickstart-android/blob/master/messaging/app/src/main/AndroidManifest.xml" rel="noreferrer">Firebase Cloud Messaging Quickstart</a> on github:</p>
  
  <pre><code>&lt;meta-data
      android:name="com.google.firebase.messaging.default_notification_channel"
      android:value="@string/default_notification_channel_id"/&gt;
  </code></pre>
  
  <p>But it does not work - FCM notifications still appear within the "Miscellaneous" channel. And I see in the logs:</p>
  
  <blockquote>
    <p>W/FirebaseMessaging: Missing Default Notification Channel metadata in
    AndroidManifest. Default value will be used.</p>
  </blockquote>
  
  <p>Of course, I tried to reinstall the app. Still having the issue.</p>
  
  <p>Well, ideally there should be some way to specify notification channel(s) on back-end at the moment of sending the messages. The FCM dev console, which allows to test sending, now has such an option in UI:</p>
  
  <p><a href="https://i.stack.imgur.com/mc08X.png" rel="noreferrer"><img src="https://i.stack.imgur.com/mc08X.png" alt="enter image description here"></a></p>
  
  <p>And it works fine. However our back-end uses Java Amazon SNS API and I have no idea if that API allows to specify Android notification channel when sending a message (because it'a new Android feature, and Amazon needs time to adopt it). So setting a default notification channel in <code>AndroidManifest.xml</code> would be a valid workaround for now, but it does not work.</p>