根據 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 客戶端,但是當我看到消息結構時,我看不到該元素結構體定義如下: https ://godoc.org/firebase.google.com/go/messaging#AndroidNotificationtype 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 消息具有高優先級,而我的消息的優先級顯示為UNKNOWN。如何按照文檔中的描述發送高優先級消息?
1 回答

蝴蝶刀刀
TA貢獻1801條經驗 獲得超8個贊
從文檔中notification_priority
:
設置此通知的相對優先級。優先級指示該通知應消耗多少用戶的注意力。在某些情況下,低優先級通知可能對用戶隱藏,而用戶可能會因高優先級通知而被打斷。設置相同優先級的效果在不同平臺上可能會略有不同。請注意,此優先級與 AndroidMessagePriority 不同。此優先級由客戶端在消息傳遞后處理,而 AndroidMessagePriority 是控制何時傳遞消息的 FCM 概念。
Go SDK 目前暫不支持該參數。請隨時在 GitHub 存儲庫中提出功能請求。
- 1 回答
- 0 關注
- 191 瀏覽
添加回答
舉報
0/150
提交
取消