EddyVerbruggen / nativescript-local-notifications

:mailbox: NativeScript plugin to easily schedule local notifications
MIT License
162 stars 57 forks source link

Notification icon #206

Open salvatorebnt opened 3 years ago

salvatorebnt commented 3 years ago

I'm here to ask you how I can set the icon of the notification. The one up and left of it. As you can see from the image i attached, there is a grey image and the app name. Is it possible to replace those segments with a custom image? I tried with icon property... But it doesnt show up Here how i manage the notification:

    LocalNotifications.schedule(
        [{
            id: id,
            title: "data.title",
            //subtitle: data.subtitle,
            body: "data.body",
            at: new Date(new Date().getTime() + 1 * 1000),
            badge: 1,
            thumbnail: "res://logo",
            icon: "res://logo",
            notificationLed: new Color("yellow"),
            forceShowWhenInForeground: true
        }])
        .then(() => {
        })
        .catch(error => console.error("exception during schedule notification: " + error));
MrSnoozles commented 3 years ago

It's not a problem with this library. Probably your icon has the wrong format/ alpha channel / transparency. Check for example https://documentation.onesignal.com/docs/customize-notification-icons for more info.

sikemullivan commented 3 years ago

You need to use an icon with transparent background. Every icon is displayed as a gray outline. Every pixel that is not 100% alpha is converted to the gray or white color. Since every pixel is filled in your image, that's why it shows up as a gray square.