White square icon on android
See original GitHub issueI set up the drawable folder like so:
I was suspecting that it might be because my icon had colors, so I downloaded a random image on the web that is white with no background:
And I’ve also set the default icon in my AndroidManifest.xml file:
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon" />
And here I’m setting the icon field to notification_icon
: https://developers.google.com/cloud-messaging/http-server-ref#downstream-http-messages-json (p.s. I’m aware that’s GCM, but it works. I’m receiving the notification with everything besides the icon)
What am I missing? All I see is a white square inside a grey circle.
This is my backend code: Pushex.push(%{title: user.name, body: "message goes here", badge: 1, sound: "default", icon: "notification_icon"}, to: user.fcm_token, using: :gcm)
(https://github.com/tuvistavie/pushex)
Issue Analytics
- State:
- Created 6 years ago
- Comments:8
Top GitHub Comments
@damathryx to fix this issue, you need to add the white icon with transparent background.
Changes in AndroidManifest.xml [in application level]
… and add white logo with transparent background in res.
sample icon image. It should be like below:
My compile and target sdk versions.
Hope it will help you and feel free to ask if it doesn’t work for you.
@diegorodriguesvieira fixed it…
Fixed it… this is so stupid. Was inspired by this answer: https://stackoverflow.com/a/28387744/1555312
I made my notification icon my app icon:
And then the magic line in
android/app/build.gradle
…Hope I save hours of someone else’s life