Using :
"react": "^15.2.1",
"react-native": "^0.31.0",
"react-native-fcm": "^1.0.16",
From the server side tried sending icon as
icon : ‘ic_launcher’
and
icon : '@mipmap/ic_launcher',
in my react-native project i have my app icon inside
/project/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
i also tried putting icon in root res folder as
/project/android/app/src/main/res/ic_launcher.png
RESULT :
A white Box is shown in the notification tray with title, when i receive notification.
But if i lock my device screen and there i can see my app icon with title displayed for the same push notification.
Need Assistance.
Thanks in Advance.
you need to use a white icon. check bottom of readme
My mistake. Pardon.
thanks @evollu
HI evollu,
Can u help me to solve the same issue,
white box is showing, when app is in background
you need to provide a notification icon with white content and transparent background. check https://github.com/evollu/react-native-fcm/tree/master/Examples/simple-fcm-client/android/app/src/main/res
Thanks evollu.
can we keep two different icon for each ie one for launcher and other for notification?
or can we send notification icon via FCM console?
yes. check that folder again, you will see icon files for notification
then in your notification payload you need to add
"icon": "ic_notif"
In my case I was not getting the icon even after inserting
"icon": "ic_notif"
in the notification payload. I solved by adding
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_notif"/>
in AndroidManifest.xml (within the <application>tag).
I hope it can be useful to someone.
Thanks @giordy . Adding meta-data worked for me. I didn't need to add 'icon' in the payload.
hi everyone,, @evollu, I need to show notification in lock screen. Any help please
@ggepenyan isn't it a phone setting? it shows up by default?
ok, thank you very much
Most helpful comment
In my case I was not getting the icon even after inserting
"icon": "ic_notif"in the notification payload. I solved by adding
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_notif"/>in AndroidManifest.xml (within the
<application>tag).I hope it can be useful to someone.