question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

White square icon on android

See original GitHub issue

https://stackoverflow.com/questions/44845797/firebase-cloud-messaging-how-to-set-the-notification-icon-on-android#44846227

I set up the drawable folder like so:

androidmanifest_xml_-_bananaclient_-____documents_src_banana-client_android_

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:

notification_icon_png_and_drawable-hdpi_and_downloads

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:closed
  • Created 6 years ago
  • Comments:8

github_iconTop GitHub Comments

16reactions
rajaishwarycommented, Oct 23, 2017

@damathryx to fix this issue, you need to add the white icon with transparent background.

Changes in AndroidManifest.xml [in application level]

  <meta-data
    android:name="com.google.firebase.messaging.default_notification_icon"
    android:resource="@mipmap/icon"
  />
  <meta-data android:name="com.google.firebase.messaging.default_notification_color"
    android:resource="@color/orange" 
  />

… and add white logo with transparent background in res.

image

sample icon image. It should be like below: image

My compile and target sdk versions. image

Hope it will help you and feel free to ask if it doesn’t work for you.

15reactions
EdmundMaicommented, Jul 1, 2017

@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:

<meta-data
    android:name="com.google.firebase.messaging.default_notification_icon"
    android:resource="@mipmap/ic_launcher" />

And then the magic line in android/app/build.gradle

defaultConfig {
    targetSdkVersion 20 // this has to be < 21
    ...
}

Hope I save hours of someone else’s life

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android White square in the status bar – Meaning - Solvemix
If you want to know what this white square means, this article will help you to find out. First of all, a white...
Read more >
Why is there a white square on my phone screen?
This symbol is of “Cast screen” found in Android which is used to cast your screen to a television. This symbol in the...
Read more >
I am not able to get rid of this white square icon on the top left ...
Try this. Long press on a blank spot in your screen, tap on widgets, scroll down until you find settings, long press on...
Read more >
android how to remove white square shortcut icon from screen
I am using phone with android 4.4.4 version. yesterday suddenly one white square appeared on my screen which looks like shortcuts for keys....
Read more >
When I press the Home key on “lock screen”, a white square ...
appears. Why is that? A : It means that the touch gestures feature to access Multiple widgets is accessible. Then, you can drag...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found