Hi
I’m still working on the application where i want to display notifications. Now I want to add a self made icon into the notifications.
I made an icon and i added it in the /img folder. (see picture )
So i thought I could reach it like this :
$cordov
aLocalNotification.schedule({
id: count,
text: $scope.notificationsPerCoach[i].content,
at: new Date(now + 60 * 60 * 24 * 1000 * count),
icon: "img/johnIcon.png"
});
Is this the right way to do it or not?
Thanks in advance
According to Cordova docs, that seems like the right way to do set the icon.
https://www.npmjs.com/package/cordova-plugin-local-notifications
1 Like
I always get this “icon” instead. Do you have to place the image somewhere else then your /img folder?
I would say you’re using the wrong path.
If your javascript is inside a js folder then you need to use this path:
aLocalNotification.schedule({
id: count,
text: $scope.notificationsPerCoach[i].content,
at: new Date(now + 60 * 60 * 24 * 1000 * count),
icon: "../img/johnIcon.png"
});
Remember that this is a relative path, in your case, plugin was looking in this location:
js/img/johnIcon.png
Did you fix this problem? I have the same issue.
I had the same problem. I solved it with “res:/icon.png” or “file:/path” only 1 “/”.
Question:
Why my icon always appear in white color if my icon is green??
Did you solve this problem?
Why my icon always appear in white color if my icon is green??
The notifications icons don’t allow colors. You have to create the icon in white and transparent color.
thanks, @CSantos8, I have done the icon with a white and transparent color, if we want to add color to that icon is there any possible ways…