Firebase:如何在 Android 应用中设置默认通知渠道? [英] Firebase: How to set default notification channel in Android app?

查看:22
本文介绍了Firebase:如何在 Android 应用中设置默认通知渠道?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为应用在后台时出现的通知消息设置默认通知渠道?默认情况下,这些消息使用杂项"频道.

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.

推荐答案

如你所见 此处在官方文档中,您需要在应用程序组件内的 AndroidManifest.xml 中添加以下元数据元素:

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.

这篇关于Firebase:如何在 Android 应用中设置默认通知渠道?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆