React-native-notifications: Migration from react-native-firebase: notification appears blank

Created on 18 Dec 2019  路  10Comments  路  Source: wix/react-native-notifications

The notification appears blank (no title and no body)
I tried to set android/app/src/main/AndroidManifest.xml like this:
>
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@mipmap/${ic_launcher}" />
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@string/default_notification_color" />
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="@string/default_notification_channel_id" />

and android/app/src/main/res/values/strings.xml

<string name="default_notification_color">#f57922</string>
<string name="default_notification_channel_id" translatable="false">channel_01</string>

This config work ok in react-native-firebase

馃彋 stale

Most helpful comment

< sarcasm >this stale bot is very useful

All 10 comments

My only thought is that your ic_launcher icon isn't compatible.
I know it seems counter-intuitive since the icon worked before, but have you tried running it through File->New->Image Asset in Android Studio? You'll be able to see there if your icon shows as a blank square or if it's rendered correctly.

I recently had to change my icon so that it was compatible (transparent background with outline of icon).

@socceroos thanks for the tip!

I also have this problem, but it is unrelated to the icon in my opinion, beacuase the icon is the only thing that appears!
I only have this problem with foreground notification, if the app is closed or hidden, then the title and body appears, but if the app is opened, only an empty notification appears :P

I had the same problem and found to some information about Notification and Data message types, link here.

I added the data key into de JSON with the title and body of the notification and then when the app is in the foreground you will also see the info as if it was on the background

Example:

{
    ...
    "notification": { 
        "title": "Title example",
        "body": "Content of the notification"
    },
    "data": {
        "title": "Title example",
        "body": "Content of the notification"
    }
}

Facing the same issue, any solution for this?

AljandroRod's solution worked for me, thanks a lot.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

< sarcasm >this stale bot is very useful

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

The issue has been closed for inactivity.

Was this page helpful?
0 / 5 - 0 ratings