Can I override default push notification icon in android from app icon to custom icon?
I am using default firebase implementation to display notification in system tray, when a push notification come. Since my app icon is coloured and has gradient, so when a notification comes, android tried to make a black/white version of it, and make it look like a white circle.
Is there a way to update the default notification icon to something else instead of default app icon?
PS: Looking forward for a solution which required a config change in manifest and don't want to use NotificationCompat.Builder
1 Tap Notification Settings on the notification panel or tap the Settings app. 2 Tap Notifications. 3 Tap App icon badges.
1. Configure custom push notifications in the Dashboard. You can configure Helpshift to send the push notification message to a custom URL instead of through APNS (For iOS) and FCM/GCM (for Android). The first step to do so is for an Admin to set up a custom push notification.
The key differentiator is that getting push notifications are the default for Android apps. For iOS, the user is prompted to allow notifications when they first open a new app, so the default is not getting push notifications for any given app.
you can use this in your manifest according to https://firebase.google.com/docs/cloud-messaging/android/receive
<!-- Set custom default icon. This is used when no icon is set for incoming notification
messages.See README(https://github.com/firebase/quickstart-android/tree/master/messaging#custom-default-icon) for more. -->
<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. See README
(https://github.com/firebase/quickstart-android/tree/master/messaging#custom-default-color) for more. -->
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/colorAccent" />
Hope it helps people.
You can set
.setSmallIcon(int);
.setLargeIcon(bitmap);
A small icon, set by setSmallIcon()
NotificationCompat.Builder setLargeIcon (Bitmap icon)
Set the large icon that is shown in the ticker and notification.
in NotificationCompat.Builder.
Documentation - https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder.html
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