Push Notification - Updating the app badge count doesn't work via APNS
Currently, we can receive alerts with no problem but when we do a "badge" count update it doesn't work. There are no errors on the push notification service either so we can't pinpoint the cause. We are doing backend device management so all device registrations are being handled by a backend service. The iOS app is on Objective-C.
Here's a snippet of our code for the badge update:
var apnsHeaders = new Dictionary<string, string>
{
{ "apns-push-type", "alert" },
{ "apns-priority", "5" }
};
var totalCount = 10; //dynamic count
var appleNotification = new AppleNotification("{\"aps\":{ \"content-available\": 1, \"badge\":\"" + totalCount + "\" }}", apnsHeaders);
appleNotification.Expiry = DateTime.UtcNow.AddDays(7);
appleNotification.Priority = 5;
var result = hub.SendNotificationAsync(appleNotification, tag).Result;