question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

smallIcon doesn't work any way

See original GitHub issue

Your Environment

  • Plugin version: 0.9.0-beta.2

  • Platform: Android

  • OS version: 10

  • Device manufacturer / model: Xiaomi Mi 8 Lite, but tried with differents emulator and other devices

  • Cordova version (cordova -v): 9.0.0

  • Cordova platform version (cordova platform ls): android 8.1.0

  • Plugin config

Expected Behavior

Hi, I’m using this plugin in order to send a local notification to my user. I’m using this code:

cordova.plugins.notification.local.schedule({
            id: Math.floor(Math.random() * 100),
            title: "Notifica di prova",
            text: 'Testo cordova',
            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>

Actual Behavior

But when the phone recive the local notification, smallIcon is not shown. I see only a gray circular icon

My question

I’ve tried all the solution proposed in this issue repository and all answers on stackoverflow. Is this plugin version bugged or I’m doing something wrong?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

10reactions
chvonrohrcommented, May 18, 2020

It worked for me with following setup:

config.xml

<platform name="android">
        <resource-file src="resources/android/notification/mia_icon_hdpi.png" target="/app/src/main/res/drawable-hdpi/mia_notification_icon.png" />
        <resource-file src="resources/android/notification/mia_icon_mdpi.png" target="/app/src/main/res/drawable-mdpi/mia_notification_icon.png" />
        <resource-file src="resources/android/notification/mia_icon_xhdpi.png" target="/app/src/main/res/drawable-xhdpi/mia_notification_icon.png" />
        <resource-file src="resources/android/notification/mia_icon_xxhdpi.png" target="/app/src/main/res/drawable-xxhdpi/mia_notification_icon.png" />
        <resource-file src="resources/android/notification/mia_icon_xxxhdpi.png" target="/app/src/main/res/drawable-xxxhdpi/mia_notification_icon.png" />
</platform>

Icon should have transparent background. It’s not possible to have differente colors, Android will apply color show it grayscaled (or the color you define - see below). Don’t use dashes (-) in the filename. Otherwise, you get errors on building.

then use the following in the trigger event:

{
  // .. other settings
  smallIcon: 'res://mia_notification_icon`,
  color: '#D3002E' // color for icon and action buttons
}
3reactions
argaarcommented, Jun 19, 2020

I can confirm the solution provided by @chvonrohr worked for me, tested on Android 10 and Android 8 (oneplus6 and samsung j3)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Windows 10 Some Icons not working??? - Microsoft Community
I haven't been able to find out why or fix it but some of the smaller icons in the bottom right on my...
Read more >
How to Fix Broken or Missing Icons and Thumbnails in ...
Fix Icons and Thumbnails from Run or Command Prompt ... If you don't want to go through a third-party app, you can try...
Read more >
Cordova Local Notifications smallIcon doesn't work any way
Using this code, local notification works fine, but the smallicon still remain grey. cordova.plugins.notification.local.schedule({ id: Math.
Read more >
Windows 10 not showing the actual Icon in small icon view
Just not in small icons or details view. I have tried adjusting Thumbnail cache size, applying the registry fix for broken icon filetypes, ......
Read more >
How to Fix Icons Not Showing on Taskbar in Windows 10 ...
How to Fix Icons Not Showing on Taskbar in Windows 10 [Tutorial]Sometimes you may find that your System Tray Notification Area Icons, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found