有没有办法将不同的徽章计数发送给同一主题的不同用户?

我有我的Node.js项目,我正在向IOS用户发送通知数量的FCM集成,我需要pipe理通知计数,即徽章计数,这将是不同的设备,但我发送通知给一个特定的主题,这些设备已订阅。

我的有效载荷是:

var payload = { notification: { title: "Title...", body: "Notification Body...", sound: "customeSound.caf", badge : "?" }, data: { testData: "custom data" } }, topic = "topicName"; admin.messaging().sendToTopic(topic, payload) .then(function (response) { // See the MessagingTopicResponse reference documentation for the // contents of response. console.log("Successfully sent message:", response); }) .catch(function (error) { console.log("Error sending message:", error); }); }); 

所有订阅相应主题的设备都将收到您设置的相同的有效负载。

你将不得不为每个设备发送一个单独的有效载荷。 或者,如果适用,也许只是将具有相似badge值的那些进行分组 – 但是这需要您发送一组令牌(使用registration_ids )而不是发送到主题。