Can't control Badge number on ios

I can’t control Badge number on ios
I’m using Expo 37

Hey @tungntq,

Sorry to hear you haven’t yet been able to implement this. Unfortunately, we’re going to need more information to help you out. Can you share the code you’ve written so far that is relevant to modifying the badge number?

Cheers,
Adam

1 Like

Hi Adam.
I just only createChannelAndroidAsync for Android. I didn’t anything for IOS
I saw 2 event about IOS Notifications.getBadgeNumberAsync() and Notifications.setBadgeNumberAsync(number) but I don’t see any demo

Hi,

If you send badge count in your push notification object, IOS can update badge:

{
	to = token,
	title = title,
    badge = badgeCount,
};

And you can also handle it by listening push notifications

import { Notifications } from "expo";

Notifications.addListener((notificaition)=>{
 	if (Platform.OS == 'ios'){
        var badgeCount = getYourBadgeCount(); // you can also add badge count in push notification object { data: { badge : smt } }
		Notifications.setBadgeNumberAsync(badgeCount);
     }
});


So on IOS API need to send badge = badgeCount, to expo server

Yes ,you can check it actually, get your token and write your token and badge here Notifications - Expo Documentation

So
how to control badgeCount when we call to expo server

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.