Ionic 2 : Local notification icon

后端 未结 4 1069
天涯浪人
天涯浪人 2021-01-02 17:15

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

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-02 17:34

    I found a solution :

    I create a new folder named "drawable" in /platforms/android/res/ I put my image in my new folder with name "ic_notifications.png" and "ic_notifications_small.png".

    In my code I wrote

    cordova.plugins.notification.local.schedule({
          id: 2,
          title: "Notification",
          message: "Retour à l'application",
          sound: null,
          at: new Date(new Date().getTime() + 5 * 1000),
          icon: 'ic_notifications',
          smallIcon: 'ic_notification_small'
        });
    

    And it works !

提交回复
热议问题