Closed ran-j closed 1 month ago
in cordova 9.0.0 target folder changed - please add app/src/main path for target
Add where ?
@ran-j here:
`
`
the icon works but smalicon dont
I think it should be "smallIcon" (with a capital i).
@timkellypa @ran-j Do you guys have prohjects on github where i could see your whole setup of how you guys did it - I cant seem to set icons at all with this plugin!
(the docs are not specific, they merely mention things without detailing each options carefully)
@boltex Unfortunately, I have nothing really to share, although when I find some time, I may attempt to build a quick sandbox for this if nobody has already. I agree that the docs aren't very descriptive, but if you look at CHANGELOG.md, that is sometimes more helpful.
The important bits for the icon, I think, are that your config.xml should have your resources in it under the Android node. They should appear as follows:
`
<resource-file src="www/path-to-your-image/48.png" target="app/src/main/res/drawable-xhdpi/icon_key.png" />
<resource-file src="www/path-to-your-image/72.png" target="app/src/main/res/drawable-xxhdpi/icon_key.png" />
<resource-file src="www/path-to-your-image/96.png" target="app/src/main/res/drawable-xxxhdpi/icon_key.png" />`
Then you just use "res://name-of-your-target" as the path for icon and smallIcon. So for this example it would be
smallIcon: 'res://icon_key'
If you see a blank gray box for your icons, this just means that you are on a device that only supports monochrome icons. I think that is Android 7 and 8 (maybe? They re-added support for multi-color icons in more recent versions.) If you're using or testing on any of those devices, the trick is to make your icon any color you want (the OS will make it gray or white depending on when it is displayed), but make the background transparent. The system will use that to create a monochrome image in the notification.
I see, Thank you!
My config.xml only has the src parts, not the target parts, its an ooder cordova project that I upgraded to a more recent cordova-android platform...
anyways,
Many thanks again!
WARNING: IF YOU IGNORE THIS TEMPLATE, WE'LL IGNORE YOUR ISSUE. YOU MUST FILL THIS IN!
Provide a general summary of the issue.
Your Environment
cordova -v
): 9.0.0cordova platform ls
): 8.1.0Expected Behavior
icon on notification.
Actual Behavior
Icons are not displaying, I spend hours reading issues and I cant make it work.
My config:
This is the icon : https://material.io/resources/icons/?icon=android&style=baseline
And my code :
And then