Cordova-plugin-local-notifications: Missing icon

Created on 8 Apr 2016  路  4Comments  路  Source: katzer/cordova-plugin-local-notifications

Hello there, since yesterday I was trying to fix a problem with missing icon on Android devices (ios works fine). I tried all solutions I found online eg.

icon: 'http://sciactive.com/pnotify/includes/github-icon.png'
icon: '../img/icon.png'
icon: 'img/icon.png' 
icon: 'res://icon.png' 

no matter how I change the icon property my notification shows as bellow :

screen

APPNAME/platforms/android/res

My android platform files shows as bellow :
screen2

Code I am using to showing notification :

$cordovaLocalNotification.schedule({
  id: email_id,
  text: subject,
  title: sender_name,
  icon: 'http://sciactive.com/pnotify/includes/github-icon.png'
}).then(function () {
  console.log('Notification triggered');
});

Any help will be highly appreciated :+1: :+1:

Thanks

Most helpful comment

Finally made it work thanks to @mix3d
All I had to do is mention which icon to pick.

$cordovaLocalNotification.schedule({
  id: email_id,
  text: subject,
  title: sender_name,
  icon: 'icon',
  smallIcon: 'icon'
  }).then(function () {
    console.log('Notification triggered');
});

When I mentioned icon android system automatically picking icon from drawable folders where I have a file named icon. If you want to use another file, put that file into your drawable folder and point to it.

If your drawable is too many, in my case drawable-hdpi, drawable-land-hdpi and 18 more folders. You have to place that file inside all those folders. Make sure your file size is exact as android icon file.

All 4 comments

Finally made it work thanks to @mix3d
All I had to do is mention which icon to pick.

$cordovaLocalNotification.schedule({
  id: email_id,
  text: subject,
  title: sender_name,
  icon: 'icon',
  smallIcon: 'icon'
  }).then(function () {
    console.log('Notification triggered');
});

When I mentioned icon android system automatically picking icon from drawable folders where I have a file named icon. If you want to use another file, put that file into your drawable folder and point to it.

If your drawable is too many, in my case drawable-hdpi, drawable-land-hdpi and 18 more folders. You have to place that file inside all those folders. Make sure your file size is exact as android icon file.

Will this solution work in IOS?

iOS automatically use system icon.

Nice one, solved my problem. Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

luca-itro picture luca-itro  路  5Comments

Kasendwa picture Kasendwa  路  3Comments

tverilytt picture tverilytt  路  4Comments

normanaranez picture normanaranez  路  3Comments

skks1212 picture skks1212  路  4Comments