Reputation: 773
I have followed this link for push notification implementation within my app https://github.com/zo0r/react-native-push-notification/tree/a359e5c00954aa324136eaa9808333d6ca246171
at present the default app launcher icon is displayed. I want to change it. Is there any way to do that?
Upvotes: 18
Views: 47630
Reputation: 388
I found solution by adding below code in AndroidManifest.xml before application closing tag:
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon" />
Generate the notification icons of all sizes at Notification Icon Generator. On the Notification Icon Generator site, set the following option before generating and downloading the files. Note, if you use your own image, the background must be transparent:
notification_icon
Once you download the files, extract all the contents into Android > src > main > res
Upvotes: 8
Reputation: 11
I found solution by adding below code in AndroidManifest.xml:
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/ic_notification" />
Upvotes: 1
Reputation: 577
You have to follow some rules for notification icon link
First, generate notification icons link of all sizes. and put the icon name ic_notification
.
Then move all sizes ic_notification
in the respective folder in the android/app/main/res/mipmap
folder and add below line in AndroidManifest.xml
file.
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_notification" />
Upvotes: 33
Reputation: 3126
you should first add the new icon in all android/app/src/main/res/mipmap-*
notice in all folders that start mipmap-* add new icon with same name with proper resolution
then in your notification object that send you can add it's name
{
largeIcon: "ic_launcher", // (optional) default: "ic_launcher"
smallIcon: "ic_notification", // (optional) default: "ic_notification" with fallback for "ic_launcher"
}
PushNotification.configure({
largeIcon: "ic_launcher",
smallIcon: "ic_notification",
})
Upvotes: 16
Reputation: 331
In AndroidManifest.xml add the below line
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_notification" />
create custom icon ic_notification and add them to mipmap and drawable folders
Upvotes: 9