簡體   English   中英

如何在 ios 中設置徽章計數 firebase 推送通知?

[英]How to setup badge count firebase push notification in ios?

我已成功設置后端以使用“firebase-admin”發送通知。 但是,我無法為我的 ios 設置徽章計數。 我目前正在使用 react native 和 node.js typescript 作為后端。

發送時我的后端管理員如下所示:

const payload = {
            notification: {
                title: "title",
                body: `body`,
              //badge: 1 this throws an error
            },
            token: receiverFcmToken
        };

        try{
            await admin.messaging().send(payload).then((response) => {
                console.log("success);
            });
        } catch(err){
            console.log(err);
        }

任何幫助,將不勝感激。 謝謝

您的有效負載應如下所示:

const payload = {
    notification: {
        title: "title",
        body: `body`,
    },
    apns: {
      payload: {
        aps: {
          badge: 1,
        },
      },
    },
    token: receiverFcmToken
};

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM