Iggy's Pop
Iggy's Pop

Reputation: 599

change expo push notification icon

According to the docs I need a 96x96 gray transparent png. I have created this and put the following in my app.json file yet still I see the expo icon. Is there something I am missing?

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

Code to send push notification

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);
}

Upvotes: 2

Views: 1772

Answers (2)

Hamza Indorwala
Hamza Indorwala

Reputation: 21

If you are still having the same problem, try this for android Create apk using expo build:android and use expo token in expo notification tool, to test icon. for ios Create build and release it on testflight to test app in real device.

Upvotes: 2

mainak
mainak

Reputation: 2311

Download the icon and place in your project folder and link the path like this

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

Download from this link :https://drive.google.com/file/d/1EEpzjoD_TONMU3Wt3NzL5nPWu1bFCs5O/view?usp=sharing

Upvotes: 2

Related Questions