更改博览会推送通知图标

时间:2020-08-08 19:08:39

标签: react-native push-notification expo

根据文档,我需要96x96灰色透明png。我已经创建了它,并将以下内容放入我的app.json文件中,但仍然看到expo图标。有什么我想念的吗?

"notification": {
  "icon": "http://example.com/pushIcon.png"
}

发送推送通知的代码

try {
    fetch("https://exp.host/--/api/v2/push/send", {
        method: "POST",
        headers: {
            Accept: "application/json",
            "Accept-Encoding": "gzip, deflate",
            "Content-Type": "application/json",
        },
        body: JSON.stringify({
            to: messages.map((value, index) => value.pushToken),
            sound: "default",
            title: 'Notification title',
            body: "This is the body of the notification",
        }),
    });
} catch (err) {
    alert("Unable to send request, please try again later.");
    console.log(err);
}

1 个答案:

答案 0 :(得分:1)

下载图标并将其放置在项目文件夹中,然后链接路径

 "notification": {
      "androidMode" : "default",
      "icon" : "./assets/pushIcon.png"
    }

从此链接下载:https://drive.google.com/file/d/1EEpzjoD_TONMU3Wt3NzL5nPWu1bFCs5O/view?usp=sharing