iOS Setting Icon Badge Number With Local Notification

Was anyone successful in setting the icon badge number using iOS.LocalNotification.applicationIconBadgeNumber?

Using the following code, notifications are displayed (with the body text and sound alert) on the iOS device but the icon badge number of the application doesn’t reflect the badge number set:

UnityEngine.iOS.LocalNotification localNotification = new UnityEngine.iOS.LocalNotification();
localNotification.applicationIconBadgeNumber = 1;
localNotification.alertBody = bodyText;
localNotification.fireDate = fireDate;
localNotification.soundName = UnityEngine.iOS.LocalNotification.defaultSoundName;
UnityEngine.iOS.NotificationServices.ScheduleLocalNotification(localNotification);

Also tried without setting the applicationIconBadgeNumber property, to no avail.

Found it, the register call was missing the NotificationType.Badge flag:

UnityEngine.iOS.NotificationServices.RegisterForNotifications(UnityEngine.iOS.NotificationType.Alert | UnityEngine.iOS.NotificationType.Sound | UnityEngine.iOS.NotificationType.Badge);

All better now. :slight_smile: