Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Showing badge with amount of unread messages from firebase on app icon

I am using Google firebase to receive messages / announcements (not push notifications) and on loading the app I get the amount of unread messages per user. Is there a way to display the amount as badge on the app icon?

Updating my question:

I am using react-native for both android and iOS. I know I can use the PushNotificationIOS, but that is (as far as I know), just for push notification.

Just when I receive new, unread messages (not push notifications), I want to show the amount of unread messages as badge.

I haven't tried anything at the moment, as all that I saw on Google was about push notification and the badge.

Clarifying my question with example:

So I get the amount of unread messages from firestore (displayed below as nrAnnounce).

I have tried the following:

componentDidMount() {
    PushNotificationIOS.setApplicationIconBadgeNumber(nrAnnounce);
}

I don't get an error, but also the IconBadge is not updated.

That code is added in the first screen I have. Would it be better to add it to the App.js?

Comments