【发布时间】:2016-10-07 18:32:05
【问题描述】:
我正在尝试使用新的推送通知堆栈或将其替换为 android 的系统托盘。
我不确定如何执行此操作,因为推送通知正在发回数据和通知对象,据我所知,通知直接发送到系统托盘。如果是这样,我如何阻止通知独立出现。一些用户会收到 5-10 条通知,并且会一直向上推送。
编辑:
我尝试了collapse_key,但它仍然不能用相同的键替换之前的通知......我在这里做错了吗?
method: 'POST',
uri: 'https://gcm-http.googleapis.com/gcm/send',
headers: {
'Content-Type': 'application/json',
'Authorization': authorize //GOOGLE API KEY
},
body: JSON.stringify({
"registration_ids": [otherUserResult.reg_id],
"collapse_key": "follow",
"data": {
"notifyToUserId": to,
"notifyFromId": from,
"notifyMsg": msg,
"notifyItemPicture": itemPic,
"notifyItemName": itemName,
"notifyFromName": fromName,
"notifyType": type,
"dateNotified": dateNotified
},
"notification": {
"title": fromName,
"body": notifyMsg,
"icon" : "ic_pushnotify"
},
"priority": "high",
"content_available": true
【问题讨论】:
-
您正在寻找所谓的可折叠消息。见firebase.google.com/docs/cloud-messaging/…
-
我正在尝试添加 "collapse_key": "follow" 但它仍然显示为新消息
-
@frankvanpuffelen 我添加了我的消息,如果我搞砸了,请告诉我
-
尝试在你的 uri 中使用新的 fcm 端点:
https://fcm.googleapis.com/fcm/send看看是否有什么不同。 -
没有区别,但谷歌表示他们相应地重定向并不重要
标签: android firebase push-notification notifications firebase-notifications