I use this plugin to have local notification : https://github.com/katzer/cordova-plugin-local-notifications/wiki/03.-Installation
I want to have a specific icon in my notification. It is located in my /www/assets/images/ folder.
I try this way but it doesn't work, I have a square icon with a bell :
public schedule() {
cordova.plugins.notification.local.schedule({
title: "New Message",
message: "Hi, are you ready? We are waiting.",
sound: null,
at: new Date(new Date().getTime() + 5 * 1000),
icon: 'file://assets/images/logo2.png'
});
}
Someone can show me the type of path I have to write ? I'm lost.
For Local push notification of ionic 2 plugin you can set the icon like below. Here icon. png will be taking from the drawable folder in android. And you can configure ionic to copy the local image file to drawable folder by adding lines mentioned below in config file under android platform section.
Local notifications are scheduled by an app and delivered on the same device. They are suited for apps with time-based behaviors, such as calendar events. When you run your app on a device with Android OS 8.0 or above, Kony uses default channels that are mentioned in the localnotificationconfig.
For Local push notification of ionic 2 plugin you can set the icon like below. Here icon.png will be taking from the drawable folder in android. And you can configure ionic to copy the local image file to drawable folder by adding lines mentioned below in config file under android platform section.
<platform name="android">
<resource-file src="resources/android/icon/icon.png" target="res/drawable/icon.png"/>
</platform>
this.localNotifications.schedule({
id: 1,
title: data.title,
text: data.body,
data: data,
icon: "res://icon.png",
smallIcon:"res://icon.png"
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With