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
public void notify(View view){ notification.setSmallIcon(R.drawable.ic_stat_name); notification.setTicker("Welcome to ****"); notification.setWhen(System.currentTimeMillis()); notification.setContentTitle("abcd"); notification.setContentText("abcd"); Intent intent = new Intent(this, home.class); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); notification.setContentIntent(pendingIntent); NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); nm.notify(uniqueID, notification.build()); }
Turn on App icon badges from Settings.Navigate back to the main Settings screen, tap Notifications, and then tap Advanced settings. Tap the switch next to App icon badges to turn them on.
1 Tap Notification Settings on the notification panel or tap the Settings app. 2 Tap Notifications. 3 Tap App icon badges.
To add an app shortcut, touch the plus button in the lower-right corner of the screen. Scroll through the list of apps and touch an app you want to add to the notification bar. Once you select an app, it's added to the main Bar Launcher screen. To add another app, touch the plus button again and select the desired app.
Basically, these are numbers or little dots that pop up over the corner of a mobile app's logo/icon, thus giving a quick indication that the mobile app in question has a new notification to share. Those dots or numbers are what we call an app icon badge.
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.
Reference
<!-- Set custom default icon. This is used when no icon is set for incoming notification messages. --> <meta-data android:name="com.google.firebase.messaging.default_notification_icon" 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. --> <meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/colorAccent" />
Try this code at your notification builder :
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context) .setSmallIcon(R.mipmap.ic_launcher) .setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher)) .setContentTitle(title) .setContentText(message) .setAutoCancel(true) .setSound(defaultSoundUri) .setContentIntent(pendingIntent); 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With