Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change android local notification icon in ionic?

I'm using ionic to build an android app. I'm using $cordovaLocalNotification for local notifications. The notification works but it shows a default bell icon. How can I customize the notification icon?

like image 740
Adam Boostani Avatar asked Sep 27 '22 09:09

Adam Boostani


1 Answers

$scope.scheduleSingleNotification = function () {
    $cordovaLocalNotification.schedule({
      id: 1,
      title: 'GRM APP Builder',
      text: 'Quer café?!?',
      badge: 1,
      icon: 'res://coffee.png',
      data: {
        customProperty: 'custom value 1'
      }
    }).then(function (result) {
      console.log('Notification 1 triggered');
    });
  };

After spend hours with this question, I saw that one comment above it's really right.

If you want to change icon, you need to create a folder called "drawable" in "[my ionic app folder]\platforms\android\res\drawable".

But the trick is: after this you need to quit your livereload mode and execute again CLI command "ionic run android -l -c -s". It's necessary because you need to copy new assets to device.

I only tested with Android device, if you can test with iOS please send a review here.

like image 195
Alexandre Rocha Avatar answered Oct 03 '22 02:10

Alexandre Rocha