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?
Navigate to Messages > New Push > Platform Settings > Google Android Options > Set the icon name without the file extension. With Large Notification Icons, you can also supply a URL where the icon will be displayed from.
1 Tap Notification Settings on the notification panel or tap the Settings app. 2 Tap Notifications. 3 Tap App icon badges.
Open Android Studio and run your React-native project. In Android Studio's Project window, select the Android view. Right-click the res folder and select New > Image Asset.
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" />
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",
})
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