cordova-plugin-foreground-service icon indicating copy to clipboard operation
cordova-plugin-foreground-service copied to clipboard

Notification icon not showing in Android 11

Open mirko77 opened this issue 3 years ago • 4 comments

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

mirko77 avatar Apr 28 '21 12:04 mirko77

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

DavidBriglio avatar Apr 29 '21 17:04 DavidBriglio

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.

mirko77 avatar Apr 30 '21 08:04 mirko77

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?

DavidBriglio avatar Apr 30 '21 12:04 DavidBriglio

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.

mirko77 avatar Apr 30 '21 13:04 mirko77

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

mirko77 avatar Jun 15 '23 08:06 mirko77