【问题标题】:change expo push notification icon更改博览会推送通知图标
【发布时间】:2020-08-08 19:08:39
【问题描述】:

根据文档,我需要一个 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);
}

【问题讨论】:

    标签: react-native push-notification expo


    【解决方案1】:

    下载图标并放置在您的项目文件夹中并像这样链接路径

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

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

    【讨论】:

    • 谢谢,我已经尝试过了,但博览会图标仍然存在。你有一个你知道有效的示例 png 吗?
    • 是的,我有,你想试试吗?
    • 是的,能把它附在这儿,让我下载试用吗?
    • 谢谢。我试过了,但是当我出于某种原因收到推送通知时,仍然显示 Expo 图标。我将用我的其他代码更新我的问题。那里可能有什么问题吗?
    • 使用清洁 expo start -c 重启
    猜你喜欢
    • 2021-03-02
    • 1970-01-01
    • 1970-01-01
    • 2016-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-30
    • 1970-01-01
    相关资源
    最近更新 更多