Android notification always appear to show the default ic_popup_reminder (bell-like) icon regardless
See original GitHub issueI have setup the local notifications and they work really well with the Ionic framework. Within my Ionic Ready block I have the following code in which I have set the icon image (I am using this image http://sciactive.com/pnotify/includes/github-icon.png)
As the path is relative to the app.js file, the image is up a level within a folder called ‘img’ and the file is called ‘github-icon.png’.
For some reason the same ‘bell’ default icon always appears?? Is this a bug? I am using Android 6.0.1 on my Nexus 5.
$scope.scheduleSingleNotification = function () {
$cordovaLocalNotification.schedule({
id: 1,
title: 'Warning',
text: 'my first notification!',
icon: 'file://img/logo.png',
}).then(function (result) {
console.log('Notification #1 triggered');
});
};
https://github.com/katzer/cordova-plugin-local-notifications/wiki/10.-URIs This is the image that appears in my local notification ftp://ftp.gunadarma.ac.id/android/sdk/sdk_310712/docs/resources/samples/ApiDemos/res/drawable-hdpi/ic_popup_reminder.html
Issue Analytics
- State:
- Created 8 years ago
- Comments:12 (1 by maintainers)
Top GitHub Comments
It took me a loooooong time but I think I have it completely under control! My relevant notification options are:
{ icon: 'file://assets/icon/notification_icon.png', smallIcon: 'res://ic_notification_icon_large' }
The first is a 128x128 icon in /src/assets/icon/notification_icon.png (it’s the one you see when you pull down the notification area) - I have tried several other sizes and this seemed the correct one. The second (the res:// one) is actually a set of icons that I prepared with http://romannurik.github.io/AndroidAssetStudio/ using asset size = 24dp. The result is a handy zip containing a single “res” folder - just copy this folder in your /platforms/android folder so that it merges with the existing “res” folder there, and voilà, all the properly resized icons are there.@gilvandev, where is your file located, in the
/platforms/android/
project? Are you familiar with the structure of Android projects? When you specify withres://
, that means the url needs to point to a file in theplatforms/android/res/
folder, but also split into the various DPI resolutions folders (drawable-xhdpi, drawable-hdpi, etc). Furthermore, because of the way android has setup it’s ‘drawable’ resources, you don’t add the filetype extension.I have a script hook to copy my icon into the correct folders, that runs on the
after_platform_add
cordova hook, to copy them from my www folder into the correct res folder.TLDR:
res://
won’t find files in thewww
folder