Home » Android » android – How to set the app icon as the notification icon in the notification drawer

android – How to set the app icon as the notification icon in the notification drawer

Posted by: admin April 23, 2020 Leave a comment


As shown in the figure…
I am getting my notification icon(on left to the red colour).
But I need to display the app icon as shown by the black arrow

enter image description here

    public void notify(View view){
    notification.setTicker("Welcome to ****");

    Intent intent = new Intent(this, home.class);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);

    NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    nm.notify(uniqueID, notification.build());
How to&Answers:

Try this code at your notification builder :

NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context)

android.app.NotificationManager notificationManager =
                (android.app.NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());

Set Large icon does the trick.Comment below if you have any further info


I know its bit late to answer here and also its already been answered, but I came here looking for an easy fix using firebase notifications. Someone like me visiting here can do the solution by recommended and easy way of firebase notification, which is simply adding meta-data in manifest.


<!-- Set custom default icon. This is used when no icon is set for incoming notification messages. -->
    android:resource="@drawable/ic_stat_ic_notification" />
<!-- Set color used with incoming notification messages. This is used when no color is set for the incoming notification message. -->
    android:resource="@color/colorAccent" />