【问题标题】:Flutter double notificationsFlutter 双重通知
【发布时间】:2021-07-27 22:36:50
【问题描述】:

我有用 Flutter 制作的端到端加密的聊天应用。当推送通知到达时,应用程序对其进行处理,解密内容并显示通知。但问题是,该应用程序未创建另一个未加密内容的通知。它看起来像这样:

这真的很烦人,我不知道如何解决这个问题。 Flutter 日志:

Handling a background message: 0:1620226730325270%0454fd8a0454fd8a
W/FirebaseMessaging(23000): Notification Channel set in AndroidManifest.xml has not been created by the app. Default value will be used.
I/flutter (23000): true
D/FlutterSecureStoragePl(23000): Read: key exists => Running ensureInitStorageCipher
D/FlutterSecureStoragePl(23000): Initializing StorageCipher
D/FlutterSecureStoragePl(23000): StorageCipher initialization complete
D/NotificationSender(23000): Notification created
I/flutter (23000): Notification created
I/flutter (23000): Notification displayed

日志说 AndroidManifest.xml 中设置的通知通道尚未由应用创建。将使用默认值。 但是频道是由应用创建的。 谢谢你的帮助。

顺便说一句,我正在使用 AwesomeNitifications 插件进行通知。

编辑: 应用程序尚未创建 AndroidManifest.xml 中设置的通知通道。将使用默认值。错误不再显示,因为我在 FCM 消息中设置了通知通道 ID 这个 ID,但通知仍然显示两次。

【问题讨论】:

    标签: android flutter push-notification notifications firebase-cloud-messaging


    【解决方案1】:

    实际上,Firebase 推送通知可以在后台发送,也可以在它们到达时立即公开。

    在这种情况下,您必须将推送通知的发送更改为仅在后台发送,这样您的过滤器就不会暴露已加密的消息。

    更多信息:

    https://firebase.google.com/docs/cloud-messaging/concept-options#notifications_and_data_messages

    【讨论】:

      猜你喜欢
      • 2021-08-21
      • 1970-01-01
      • 2018-01-09
      • 2012-12-11
      • 1970-01-01
      • 1970-01-01
      • 2013-02-13
      • 2019-06-28
      • 1970-01-01
      相关资源
      最近更新 更多