I am using firebase
and react-native-push-notification
to push notifications to my Android app and struggling to change the small notification icon with my own icon and none of the threads about this topic seems to help. I have the ic_test.png
located in my @mipmap
folder and none of these metadata declarations in my Android manifest work:
1.
xml <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/ic_test" />
2.
xml <meta-data android:name="com.dieam.reactnativepushnotification.notification_icon" android:resource="@mipmap/ic_test" />
I am however able to change the color of the icon by adding metadata:
<meta-data
android:name="com.dieam.reactnativepushnotification.notification_color"
android:resource="@android:color/white"
/>
Situation:
Any ideas what I might be doing wrong here?
EDIT:
Got it working for local notifications by not setting any icon metadata resource in the manifest. I just set the following metadata resource
<meta-data
android:name="com.dieam.reactnativepushnotification.notification_color"
android:resource="@android:color/MY_COLOR"
/>
to change the background color of the icon.
Also, set the following key-value pair
PushNotification.localNotification({...parameters, smallIcon: 'ic_test'});
When triggering a local notification.
EDIT:
I am using Firebase Cloud Messaging legacy HTTP protocol and setting the icon
parameter to "ic_test"
does not seem to do the trick also.