[question]: Custom push notification icon in Ionic Capacitor
ayokay123 opened this issue · comments
How can we help?
I'm currently encountering an issue while attempting to add the ic_stat_onesignal_default
icon in a Capacitor project for Android. The documentation provides information on manually creating icons but does not specifically cover the Capacitor case.
I initially attempted to include the default icon inside capacitor-cordova-android-plugins
, but after running npm run build && npm run sync
, the updates I made were not reflected.
Now, I'm seeking guidance on the appropriate location to add the default icon for Capacitor. I've considered placing it either in app->src->main->AndroidManifest.xml
or app->src->main->xml->config.xml
. However, I'm unsure of the correct approach.
Has anyone encountered a similar situation with Capacitor and successfully resolved it? Some guidance would be appreciated.
Code of Conduct
- I agree to follow this project's Code of Conduct
It seems to work - kindof. I get a large icon to the left of the message as expected. To the right of the message I get something a bit odd looking :D
OK this is now working as expected. I created a monochrome .png
as per the docs and used
https://romannurik.github.io/AndroidAssetStudio/icons-notification.html#source.space.trim=1&source.space.pad=0&name=ic_stat_onesignal_default
to generate the required folders/images. These folders can just be dropped straight into android/app/src/main/res
.
I then put a full colour 256x256 png into drawable-xxxhdpi
called ic_onesignal_large_icon_default.png
(this gets displayed in the message body).
I then specified an accent-color
for the small icon. You can pass this on the createNotification
REST API call or via the method described here https://documentation.onesignal.com/docs/customize-notification-icons#set-default-small-icon-and-accent-colors
Seemed to work just fine with no other config.
Yup worked for me as well 🙌