When I send notifications from Firebase console without channel specified on Android Oreo it must use "Miscellaneous" channel OR if provided default channel from Android manifest. So I create and provide default channel in my app:
// Application onCreate
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val manager = getSystemService(Context.NOTIFICATION_SERVICE)
as NotificationManager
val channelId = getString(R.string.notification_channel_id)
if(manager.getNotificationChannel(channelId)==null) {
val channel = NotificationChannel(channelId,
getString(R.string.notification_channel_name),
NotificationManager.IMPORTANCE_DEFAULT)
channel.description =
getString(R.string.notification_channel_description)
manager.createNotificationChannel(channel)
}
}
// Manifest
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel"
android:value="@string/notification_channel_id" />
But it doesn't work. Notifications always use "Miscellaneous" channel. Am I missing something here or is it a Firebase bug?
apologies, apparently the documentation has not been updated properly :(
The correct metadata in the manifest is:
Note the
_id
at the end of theandroid:name
attribute value.Will get the documentation updated asap.