-
Notifications
You must be signed in to change notification settings - Fork 653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ionic resource icon for Android push notifications #608
Comments
Second! Just looking for a way to do this too. |
+1 |
I can't figure out a way to display an icon on my received push notifications. |
+1 I use I generate "old" icons with After that I generate a new png with a new name with this tool: http://romannurik.github.io/AndroidAssetStudio/icons-notification.html and paste all the generated folders in the
and the large icon from the JSON sent as push:
where Tested on two devices so far. Works fine. |
+1 |
5 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
Here is a solution
|
+1. please let us know if you consider the feature valuable, so maybe someone from community will send a PR for that If you're unfamiliar with the context: in Android 5.0+, push notification icon has to be two-color: transparent background + white foreground; otherwise the default app icon is taken, and anything non-transparent is displayed as white (so very likely, the user will see a white square) Now, to prevent that, you can have a separate icon only for push notifications, and pass that name to the cordova push plugin. I'm for now using a combination of solutions from @adyz and @awebdeveloper i.e. generate icons via a website, commit them to git to a custom folder, then copy the images to |
+1 |
3 similar comments
+1 |
+1 |
+1 |
For anyone here for ionic2, you can:
I think this whole process can be generalized and put into a plugin that should be included in https://github.com/driftyco/ionic-gulp-tasks. |
am i the only one experiencing this but all the icons generated via http://romannurik.github.io/AndroidAssetStudio/icons-notification.html are just all white circles. i dont see my icon at all. @wli |
@boyfunky notification icons are only two colors - white or transparent. The white circle implies that your icon has a circle shape. You probably want some kind of transparency so you get some kind of shape. |
+1 |
1 similar comment
+1 |
Another way to prevent notification icon to be white-transparent is to set the Target SDK to any value below 20.. (lollipop).. |
Without hackery like lowering the target SDK just save the icon in 8bit Grayscale with Alpha-Channel. |
I created the hook below, based on this code, that you can set as an
Just create a
The hook copies all files and directories recursively inside Just make sure that the icons are in the correct directories. The utility below already does that for you (it creates a zip file with the correct folders, just paste it inside You can create a notification icon for android in https://romannurik.github.io/AndroidAssetStudio/icons-generic.html. |
Don't forget that once you add these icons to the res/ folder, you need to configure the push plugin to use them: E.g. If you have res/other/android/res/:
You'd still need need:
|
+1 |
Hi Guys, I'm having some issues, and can't seem to get the combination of images/folders and config right here to get the small icon working in the notification bar of Android - I'm simply shown a square, In my app.js I have:
I can see that this config is being used, by changing "iconColor" I am able to get a little blue or red square! Within my \android\res\drawable-resolution folders, I have the png's as generated by the AndroidAssetStudio generator tool, as white on alpha png's What am I missing? |
The folders containing the icon files need to end up here:
Make sure your build is putting them there. I use this 'after_prepare' hook script:
|
It's a real pain to get right. And the error messaging is non-existent. Lots of trial and error. |
Is just manually putting them into location not enough? Would a Gulp task do the job? |
I think that the hook file does a good job in copying the files after execution but i think the real problem lies in the android firmware unable to detect the location of the icon from its root |
If your only problem is with the notifications icons appearing correctly on Android, the following worked for me - take the drawable-xhdpi-icon icon (size 96x96), rename it icon.png and place it in two places: The drawable folder is a new folder which can be created by copying platforms/android/res/mipmap-xhdpi to platforms/android/res/drawable manually or with the aid of a hook. In your code, the local or geofence notification is referenced as follows:
If ionic cordova resources is part of the problem, you can do your own one-time setup by taking your largest icon and, with the help of a resizing tool such as resizeimage.net, create a set of icons for iOS and Android. |
I can't make this work...My recipe...
any suggestions ? |
@marcojr I recommend you not rename the files generated at https://romannurik.github.io/AndroidAssetStudio/icons-generic.html , but keep them with the same name and inside the created folders. What should be done is copying all the folders inside I defined Like I said before, the contents inside My notification icon is The hook just copy the contents inside First I'd recommend to use the same paths as mine to see if it works (if it works you can move your folders to another loaction and change the The only error you got that I don't know why is that with I don't recommend putting the icons manually inside the platforms folder, because the hook is basically to avoid that (the platforms folder should be such that you could delete it and generate it again without doing any manual changes). |
Ty, guys ! But looks like the solution provided by dovk really works and it's insanely simple ! |
Hey Ionic!
Would be nice if we could automatically set an icon for multiple resolutions as a custom push notification icon, as an addition to the app's icon & splash screen.
The text was updated successfully, but these errors were encountered: