rabiaasif
rabiaasif

Reputation: 312

Push notifications ios equivalent for android

I am relatively new to mobile development I am using react native, and i am trying to implement badge notifications for android this is what works on ios:

PushNotificationIOS.setApplicationIconBadgeNumber(count);

I cant seem to find the android equivalent of this I have been referring to this https://github.com/wix/react-native-notifications

It doesnt seem to have anything for badges though Would really appreciate some one pointing me in the right direction

Upvotes: 3

Views: 906

Answers (2)

rabiaasif
rabiaasif

Reputation: 312

I SOLVED MY OWN ISSUE: The problem is, you dont manage badge notifications through front end for android like you do with IOS!!! THE SOLUTION: Test on sns if your message is being sent: when you send your push notification through your api your payload should look like this

        ({
              notification: _.assign({ }, payload, {
                body: message,
                message,
                title: payload.MESSAGETITLE
                badge: THIS SHOULD BE AN INT
              })
            })

NOTE is says notification this is a recent FCM update. The int you pass through badge wont matter because it only increments by one, but it has to be an int

Upvotes: 2

Bajju
Bajju

Reputation: 935

You could use this one https://www.npmjs.com/package/react-native-android-badge

var BadgeAndroid = require('react-native-android-badge');

BadgeAndroid.setBadge(10);

Upvotes: 0

Related Questions