cordova-plugin-foreground-service
cordova-plugin-foreground-service copied to clipboard
Notification icon not showing in Android 11
Not sure this plugin is still maintained, anyway here we go:
Describe the bug The notification icon does not show in Android 11, the default star icon is shown instead
cordova.plugins.foregroundService.start('Epicollect5', 'Taking Photo...', 'ic_launcher.png', 2, 10);
Android 10
Android 11
Hey @mirko77, are you sure that your icon image is being coped to the platforms/android/app/src/main/res/drawable
folder?
https://github.com/DavidBriglio/cordova-plugin-foreground-service#icon
Yes. As you can see, the icon shows correctly on Android 10, Xiaomi MI 9 see
I get the star icon on Android 11 Lineage OS. It might have something to do with the fact it is a custom Rom so maybe things do not work as expected.
I will test this again with Android 11 and see. It could be that the resource path has been altered. I would also like to ask what purpose you are using this plugin for? Do you need to use a foreground service, or could it just be a local notification?
I start the foreground service before taking a picture or picking an image from the gallery to avoid app restarts, it is a workaround to this issue -> https://github.com/ionic-team/capacitor/issues/2931
Nothing major if the icon does not show, no worries.
After 2 years I realised the icon name must be passed without the extension (.png
).
It's weird it works in some Android versions and not in others though