1

I'm I'm stuck with the implementation of the smallIcon with the cordova-plugin-local-notifications plugin.

This is my environment:

  • Plugin version: 0.9.0-beta.2
  • Platform: Android
  • OS version: 10
  • Device: Xiaomi Mi 8 Lite, but tried with differents emulators and other devices
  • Cordova version: 9.0.0
  • Cordova platform version (cordova platform ls): android 8.1.0

Using this code, local notification works fine, but the smallicon still remain grey.

cordova.plugins.notification.local.schedule({
    id: Math.floor(Math.random() * 100),
    title: "My title",
    text: 'My text',
    icon: 'https://myurl.com/image.png',  //this work
    smallIcon: 'res://ic_launcher', // this doesn't work
    led: "FF0266",
});

and my config.xml is setted like this:

<platform name="android">
      <preference name="StatusBarOverlaysWebView" value="false" />
      <preference name="android-minSdkVersion" value="21" />
      <preference name="SplashMaintainAspectRatio" value="true" />

      <splash density="land-hdpi" src="res/screen/android/drawable-hdpi/screen.png" />
      <splash density="land-mdpi" src="res/screen/android/drawable-mdpi/screen.png" />
      <splash density="land-xhdpi" src="res/screen/android/drawable-xhdpi/screen.png" />
      <splash density="land-xxhdpi" src="res/screen/android/drawable-xxhdpi/screen.png" />
      <splash density="land-xxxhdpi" src="res/screen/android/drawable-xxxhdpi/screen.png" />
      <splash density="port-hdpi" src="res/screen/android/drawable-hdpi/screen.png" />
      <splash density="port-mdpi" src="res/screen/android/drawable-mdpi/screen.png" />
      <splash density="port-xhdpi" src="res/screen/android/drawable-xhdpi/screen.png" />
      <splash density="port-xxhdpi" src="res/screen/android/drawable-xxhdpi/screen.png" />
      <splash density="port-xxxhdpi" src="res/screen/android/drawable-xxxhdpi/screen.png" />

      <icon density="ldpi" src="res/icon/android/mipmap-ldpi/ic_launcher.png" />
      <icon density="mdpi" src="res/icon/android/mipmap-mdpi/ic_launcher.png" />
      <icon density="hdpi" src="res/icon/android/mipmap-hdpi/ic_launcher.png" />
      <icon density="xhdpi" src="res/icon/android/mipmap-xhdpi/ic_launcher.png" />
      <icon density="xxhdpi" src="res/icon/android/mipmap-xxhdpi/ic_launcher.png" />
      <icon density="xxxhdpi" src="res/icon/android/mipmap-xxxhdpi/ic_launcher.png" />

</platform>

I've tried all the solution proposed in this issue repository (https://github.com/katzer/cordova-plugin-local-notifications) and all answers on stackoverflow. Is this plugin version bugged or I'm doing something wrong?

Steve
  • 354
  • 1
  • 9

1 Answers1

-1

Did you try to use res://ic_launcher as icon? I use this way in my app and it works.

Another thing, see if your problem isn't the same bellow. Android Push Notifications: Icon not displaying in notification, white square shown instead

Ronaldo
  • 1
  • 1