当从 Flutter 应用程序中的云函数接收 FCM 时,在 iOS 上,通知会按预期显示在横幅和系统托盘中。但是,在 Android 上,当应用程序终止或在后台时,通知会直接显示在系统托盘中而不显示横幅。
我正在使用最新版本的 Flutter 和 firebase 消息传递插件,并在 中设置
default_notification_channel_id
了AndroidManifest.xml
,然后我使用本地通知插件创建了一个 Android 通知通道,其名称与我在其中设置的名称相同,AndroidManifest.xml
并且我确实importance: Importance.max
为通道设置了。
我花了几天时间尝试显示提醒通知,我将所有文档和相关问题都涂红了,但不幸的是它仍然没有显示。虽然我正在使用本地通知插件在前台显示提示通知,但没有问题。
最后我使用了本地通知插件来显示通知,FirebaseMessaging.onBackgroundMessage
所以我得到了抬头通知,但 FCM 发送的原始通知仍在通知托盘中。
我很感激任何帮助。
编辑: 问题是我用于测试的 Android 版本,通知通道是一个特定于 Android 8 或更高版本的概念,这就是为什么 API 文档声明创建通道的方法仅适用于那些版本的 Android
有没有办法在 Android 6 的背景上显示抬头通知?我怎样才能默认 FirebaseMessaging 渠道重要性?