React-native-push-notification: Example for setApplicationIconBadgeNumber would be super nice.

Created on 11 Nov 2016  路  5Comments  路  Source: zo0r/react-native-push-notification

So this isn't really an issue, but I can not for my life figure out how to get the icon badge to work.
I've tried a few things with the PushNotification.setApplicationIconBadgeNumber but with no result.

So a small example how to make it work would be super nice and much appreciated.

// I'm primarily interested in iOS

Most helpful comment

Try PushNotification.setApplicationIconBadgeNumber(1);

All 5 comments

There's no need to use this library if you're only using iOS. Just use the PushNotificationIOS library bundled with react-native. It doesn't add any value for iOS.

WRT setting the badge number... there's no trick to it really. Are you seeing any error messages? Are you using a real device? I don't think it will work on a simulator.

Well, I'm thinking I'll get around to Android after iOS is in place so I'll stick around with this for a while longer ;-)

But Yes I'm using a real iPhone, and putting in:

PushNotification.setApplicationIconBadgeNumber({
number: 1
});

Try PushNotification.setApplicationIconBadgeNumber(1);

Ah there we go, but way didn't I try that ;-)

Not working on Android.

Was this page helpful?
0 / 5 - 0 ratings