Push Notification - Updating the app badge count doesn't work via APNS

Anonymous
2020-07-28T02:32:16.55+00:00

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;

Azure Notification Hubs
Azure Notification Hubs
An Azure service that is used to send push notifications to all major platforms from the cloud or on-premises environments.
325 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.