I have a fairly simple app that registers a few users Android and iOS users with Azure Notification Hubs with two tags, their ID and their language. However, I've noticed that when sending a message to large groups, only a couple of iOS devices that should receive the message get it. But if I loop through all accounts and send the message using their ID tag, every single iOS device receives the message.
I am aware that iOS delivery is not guaranteed, but with only ~10 iOS devices, I have been able to send each and every device a push if I use the ID tag, but not if I use the language tag or do a tagless push.
I am on the Basic tier with one reserved unit and nine maximum units. The Azure portal does not report any delivery, network or payload errors.
The server side registration looks a little bit like this (following the example listed on Azure here):
foreach(var user in users)
{
//ID is a long and unique per user
//Language is an int - all accounts being tested have language of 0
var tags = new HashSet<string>();
tags.Add("ID-" + user.ID);
tags.Add("Language-" + user.Language);
//Register or update based on user.Device
client.CreateAppleNativeRegistrationAsync(user.pushID, tags);
client.CreateGcmNativeRegistrationAsync(user.pushID, tags);
}
The following hit's all Android devices but does not hit iOS devices consistently. iOS devices only see the message one in ten attempts or so. Both the language tagged and tagless pushes have about the same delivery rate on iOS devices.
string apnsMessage = "{\"aps\":{\"alert\":\"" + message + "\"}}";
string gcmMessage = "{\"data\":{\"message\":\"" + message + "\"}}";
//Language Tag
client.SendAppleNativeNotificationAsync(apnsMessage, "Language-0");
client.SendGcmNativeNotificationAsync(gcmMessage, "Language-0");
//Tagless Push
client.SendAppleNativeNotificationAsync(apnsMessage);
client.SendGcmNativeNotificationAsync(gcmMessage);
The following works for every Android and iOS device. Every single device receives the message within seconds, 99% of the time.
string apnsMessage = "{\"aps\":{\"alert\":\"" + message + "\"}}";
string gcmMessage = "{\"data\":{\"message\":\"" + message + "\"}}";
foreach(var user in users)
{
client.SendAppleNativeNotificationAsync(apnsMessage, "ID-" + user.ID);
client.SendGcmNativeNotificationAsync(gcmMessage, "ID-" + user.ID);
}
What does the telemetry say? How many outgoing notifications are sent to apns? (You can get the breakdown in the monitor tab and adding the APNS metrics with the button "Add Metric"). If you see the right number of successes, try to set an expiry value for your Apple notification.
If you do not solve the issue, send an email to [email protected]. Thanks,