gpt4 book ai didi

android - 在 firebase admin go 客户端中设置 notification_priority

转载 作者:行者123 更新时间:2023-11-29 18:25:56 28 4
gpt4 key购买 nike

根据 firebase 文档,我们可以设置参数 notification_priority 来确定消息的优先级。

https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#androidnotification

{
"title": string,
"body": string,
"icon": string,
"color": string,
"sound": string,
"tag": string,
"click_action": string,
"body_loc_key": string,
"body_loc_args": [
string
],
"title_loc_key": string,
"title_loc_args": [
string
],
"channel_id": string,
"ticker": string,
"sticky": boolean,
"event_time": string,
"local_only": boolean,
"notification_priority": enum (NotificationPriority),

我正在尝试使用 firebase admin go client 但是当我看到消息结构时,我看不到该元素

结构定义如下: https://godoc.org/firebase.google.com/go/messaging#AndroidNotification

type AndroidNotification struct {
Title string `json:"title,omitempty"` // if specified, overrides the Title field of the Notification type
Body string `json:"body,omitempty"` // if specified, overrides the Body field of the Notification type
Icon string `json:"icon,omitempty"`
Color string `json:"color,omitempty"` // notification color in #RRGGBB format
Sound string `json:"sound,omitempty"`
Tag string `json:"tag,omitempty"`
ClickAction string `json:"click_action,omitempty"`
BodyLocKey string `json:"body_loc_key,omitempty"`
BodyLocArgs []string `json:"body_loc_args,omitempty"`
TitleLocKey string `json:"title_loc_key,omitempty"`
TitleLocArgs []string `json:"title_loc_args,omitempty"`
ChannelID string `json:"channel_id,omitempty"`
ImageURL string `json:"image,omitempty"`
}

firebase 文档和结构是否存在差异,或者我遗漏了什么?问题是,如果设备正在休眠,消息会传送到设备但没有声音或屏幕显示。 (发生在一加7 pro上,只是偶尔)

我使用以下命令检查了事件

   1.  Dial *#*#426#*#* to open the FCM Diagnostics page.
2. Tap the EVENTS button to show the event log.
3. Check whether the message was delivered to the device. There should be a log entry reading

并且看到 YouTube 消息的优先级为,而我的消息的优先级显示为未知

如何发送文档中描述的高优先级消息?

最佳答案

来自notification_priority 的文档:

Set the relative priority for this notification. Priority is an indication of how much of the user's attention should be consumed by this notification. Low-priority notifications may be hidden from the user in certain situations, while the user might be interrupted for a higher-priority notification. The effect of setting the same priorities may differ slightly on different platforms. Note this priority differs from AndroidMessagePriority. This priority is processed by the client after the message has been delivered, whereas AndroidMessagePriority is an FCM concept that controls when the message is delivered.

此参数目前在 Go SDK 中不可用。欢迎在 GitHub 存储库中提交功能请求。

关于android - 在 firebase admin go 客户端中设置 notification_priority,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59033584/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com