Android Firebase发送多个推送通知,而不是堆叠或替换
我正在尝试用新的推送通知堆栈替换以前的推送通知堆栈,或者在android系统托盘中替换它 我不知道该怎么做,因为推送通知同时发送回数据和通知对象,据我所知,通知直接发送到系统托盘。如果是,我如何阻止通知独立出现。一些用户会收到5-10条通知,并且会继续推高 编辑: 我尝试使用相同的密钥替换以前的通知,但它仍然不能替换以前的通知。。。我在这里做错了吗Android Firebase发送多个推送通知,而不是堆叠或替换,android,firebase,push-notification,notifications,firebase-notifications,Android,Firebase,Push Notification,Notifications,Firebase Notifications,我正在尝试用新的推送通知堆栈替换以前的推送通知堆栈,或者在android系统托盘中替换它 我不知道该怎么做,因为推送通知同时发送回数据和通知对象,据我所知,通知直接发送到系统托盘。如果是,我如何阻止通知独立出现。一些用户会收到5-10条通知,并且会继续推高 编辑: 我尝试使用相同的密钥替换以前的通知,但它仍然不能替换以前的通知。。。我在这里做错了吗 method: 'POST', uri: 'https://gcm-http.googlea
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
在我的“通知”中包括两行时,我的工作:
collapse_key: 'your_app_unique_string',
tag: 'your_app_unique_string'
因此,完整的代码是:
var payload = {notification: {
title: "Mensaje de "+message.name,
body: message.text,
sound: "default",
collapse_key: 'charlero',
tag: 'charlero'
}
};
您正在寻找所谓的可折叠消息。看,我正在尝试添加“collapse_key”:“follow”,但它仍然显示为一个新的message@frankvanpuffelen我添加了我的消息,如果我在uri中使用新的fcm端点时弄乱了什么,请告诉我:
https://fcm.googleapis.com/fcm/send
看看这是否有什么区别。没有区别,但谷歌表示,他们相应地重定向并不重要