简体   繁体   English

如何使用 FCM 在 Android 上发送高优先级收件箱样式通知?

[英]How do I send a high priority inbox style notification on Android using FCM?

I want to send a high priority notification to Android devices using FCM and have it displayed in the system tray as an Inbox style notification.我想使用 FCM 向 Android 设备发送高优先级通知,并将其作为收件箱样式通知显示在系统托盘中。

FCM does not allow you to configure the Android notification style server side, so I must send the send the android system notification client side, to use NotificationManager API to send an inbox style notification. FCM 不允许您配置 Android 通知样式服务器端,因此我必须发送 android 系统通知客户端,以使用 NotificationManager API 发送收件箱样式通知。

The only way to do this without an automatic default style notification is to use FCM data messages.在没有自动默认样式通知的情况下执行此操作的唯一方法是使用 FCM 数据消息。 But the Firebase Flutter docs (I am trying to implement a solution for this on Android Native and Flutter, but a Android Native solution will suffice) indicate that data messages are low priority...但是 Firebase Flutter 文档(我正在尝试在 Android Native 和 Flutter 上为此实施解决方案,但 Android Native 解决方案就足够了)表明数据消息的优先级较低......

From the flutterfire docs :来自flutterfire 文档

As mentioned above, data only messages are classed as "low priority".如上所述,仅数据消息被归类为“低优先级”。 Devices can throttle and ignore these messages if your application is in the background, terminated, or a variety of other conditions such as low battery or currently high CPU usage.如果您的应用程序处于后台、终止或各种其他情况(例如电池电量不足或当前 CPU 使用率较高),设备可以限制并忽略这些消息。

You should not rely on data only messages to be delivered.您不应依赖于仅传递数据的消息。 They should only be used to support your application's non-critical functionality, eg pre-fetching data so the next time the user opens your app the data is ready to be displayed and if the message never gets delivered then your app still functions and fetches data on open.它们应该只用于支持您的应用程序的非关键功能,例如预取数据,以便用户下次打开您的应用程序时,数据已准备好显示,如果消息从未传递,您的应用程序仍然可以运行并获取数据在打开。

So it seems, based on the premises presented here, that it is impossible to send a high priority inbox style notification on Android. Is this correct?因此,根据此处提供的前提,似乎不可能在 Android 上发送高优先级收件箱样式通知。这是正确的吗?

I think you still can.我觉得你还是可以的。 Even though data message is normal priority by default, you can still manually set it to high as stated in the doc .即使默认情况下数据消息是普通优先级,您仍然可以手动将其设置为high优先级,如文档中所述。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何通过 AWS SNS 发送高优先级推送通知 - How to send the High priority push notification through AWS SNS Android 的 FCM 通知优先级被忽略 - FCM notification priority is being ignored for Android 如何使用 Node.js 向所有 Android 设备发送 FCM 通知 - How to send FCM notification to all android devices using Node.js Firebase Notification Composer:如何将通知优先级设置为“高”? - Firebase Notification Composer: How to set notification priority to "high"? 如何从 web 向应用程序发送 FCM 通知 - How to send FCM notification to app from web 如何使用 FCM 在 iOS 和 Android 中跟踪收到的通知? - How to track received notification in iOS and Android using FCM? 为什么 Android 不退出打盹模式,尽管 FCM 中消息的优先级很高? - Why Android does not exit DOZE mode, despite the high priority of the message in FCM? 如何使用 firebase 在 android 中的通知中发送图像? - how to send image in notification in android using firebase? 可以在特定时间使用 FCM IN FLUTTER 发送推送通知 - It is Possible to send Push notification at specific time Using FCM IN FLUTTER Android - 如何设置提示通知图标背景颜色(使用 FCM 或默认值)? - Android - How to set heads-up notification icon background color (using FCM or default value)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM