Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android notification icon is a white circle

I've got a strange problem with notification icon today.

It looks like this : enter image description here (the white circle ...)

Did I do something bad ?

Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
                .setSmallIcon(R.drawable.icon_notification)
                .setContentTitle(this.getString(R.string.notification_title))
                .setContentText(this.getString(R.string.notification_text))
                .setAutoCancel(true)
                .setSound(defaultSoundUri)
                .setContentIntent(pendingIntent);

Here is my icon image (freshly downloaded from here https://material.io/icons/#ic_photo) : http://image.noelshack.com/fichiers/2016/44/1478185219-icon-notification.png

Did I miss something ?

For the record, I'm using SDK 24 and only created the hdpi resource folder for now.

Edit #1 : I've added the ldpi, mdpi and xhdpi icons, nothing change ...

Edit #2 : For more precision, I'm trying to create this notification from a service ... FCM messaging service ...

like image 313
PoulsQ Avatar asked Nov 03 '16 15:11

PoulsQ


People also ask

What is the white circle icon on Android?

The "white circle" is just the current Android theme. From time to time Google invents a new "cool" style how icons should look. You can try to change the shape in developer options: android.gadgethacks.com/how-to/…

Why is the new icon created with a white circle?

If you want to keep displaying your app icon in a square, you'll have to build your app using Android SDK 25 of less. If your app is compiled with Android SDK 26 or more, your app icon will appear inside a white round, whether you use the new adaptative icon format or the legacy format.

Can Android change notification icons?

Currently users can't change the notification icon, but I could make it possible to select one of the 300+ Automate icons. A custom picture isn't possible since Android requires the images to be packaged within the app.


2 Answers

If your compileSDKversion is above 20 then notification icon should be a white-on-transparent background image. Otherwise the image will be rendered as a white colored image.

Please go through the below link too for guidelines to create the icon

https://www.google.com/design/spec/patterns/notifications.html

and also the notification icon generator.

https://romannurik.github.io/AndroidAssetStudio/icons-notification.html#source.space.trim=1&source.space.pad=0&name=ic_stat_example

like image 161
Ajith K P Avatar answered Oct 23 '22 04:10

Ajith K P


I had the same problem while the app is closed and this helped me

Unfortunately this was a limitation of Firebase Notifications in SDK 9.0.0-9.6.1. When the app is in the background the launcher icon is use from the manifest (with the requisite Android tinting) for messages sent from the console.

With SDK 9.8.0 however, you can override the default! In your AndroidManifest.xml you can set the following fields to customize the icon and color:

<meta-data
    android:name="com.google.firebase.messaging.default_notification_icon"
    android:resource="@drawable/notification_icon" />
<meta-data android:name="com.google.firebase.messaging.default_notification_color"
    android:resource="@color/google_blue" />
like image 22
mrcosmic Avatar answered Oct 23 '22 04:10

mrcosmic