Firebase: How to set default notification channel in Android app?

Maksim Ostrovidov picture Maksim Ostrovidov · Sep 5, 2017 · Viewed 38.1k times · Source

How to set default notification channel for notification messages that come when an app is in the background? By default, these messages use "Miscellaneous" channel.

Answer

Maksim Ostrovidov picture Maksim Ostrovidov · Sep 5, 2017

As you can see here in the official docs, you need to add the following metadata element in your AndroidManifest.xml within the application component:

<meta-data
    android:name="com.google.firebase.messaging.default_notification_channel_id"
    android:value="@string/default_notification_channel_id"/>

This default channel will be used when notification message has no specified channel, or if the channel provided has not yet been created by the app.