3

When trying to send an AppleNotification with SendDirectNotificationAsync() with a list of targets, the hubclient responds with the exception

thrown: 'Microsoft.Azure.NotificationHubs.Messaging.QuotaExceededException This operation is not available for your tier.TrackingId:6f14d008-2621-4b8a-881f-857d4f51dda6_G5,TimeStamp:3/31/2020 10:44:50 AM"'

and thats all the info i got.

My code

var alert = "{\"aps\":{\"alert\":{\"title\":\"" + newNotification.Title + "\",\"body\":\"" + newNotification.Content + "\"}}}";
if (newNotification.Targets != null)
{
    notification = new AppleNotification(alert);
    outcome = await _hubClient.SendDirectNotificationAsync(notification, newNotification.Targets);
}

_hubclient is an Instance of NotificationHubClient

newNotification.Targets is a String List containing the Notification Tokens

-

With 1 device token it works perfectly, even with a FCMNotification and a list of android device tokens, it has no problems.

I could not find any info on the pricing tiers about sending an APNS notification to multiple devices or anything else about direct messages to multiple devices. I also tried searching for the different exception messages and the meaning of them but couldn't find anything. Apple's documentation didn't help me either but i didn't expect it to because the exception comes from Azure and in the metrics APNS didn't have any monitoring messages on the failed notification.

Does anyone know what this exception could mean for my case and why it isn't allowed while it is allowed for Android.

D.Slutter
  • 144
  • 1
  • 9
  • Just for the purposes of gathering data, have you tried upgrading to the next tier to see if this error still persists? – Rob Reagan Mar 31 '20 at 12:58
  • @RobReagan I did not as i couldn't find any difference about sending to multiple devices between the two and i wanted to be sure before i went any further because it's not my decision to make but the decision of my internship supervisor. As it's not the main priority at the moment it has to wait but I'l react on your comment again once we decided to upgrade or know more of the pricing tiers – D.Slutter Mar 31 '20 at 13:16
  • Ah, I see. NotificationHubs documentation (at least when I looked about a year ago) was severely lacking. Are you working on the free tier right now? – Rob Reagan Mar 31 '20 at 13:18
  • @RobReagan Yes. As long as it is possible for testing, we use the free tier. – D.Slutter Mar 31 '20 at 13:23
  • @D.Slutter how many tokens do you have in the `Targets` property? NH has a limit of 1000 tokens per a single batch call. – stankovski Mar 31 '20 at 16:31
  • 1
    Also, the batch API is only available in Basic and Standard tiers - https://learn.microsoft.com/en-us/rest/api/notificationhubs/direct-batch-send – stankovski Mar 31 '20 at 16:48
  • @stankovski I have 2 tokens in my property. Thanks for the link, that explains why it doesn't work for iOS but not why it does work for Android. I'l inform my supervisor about it. – D.Slutter Apr 01 '20 at 07:25
  • @stankovski Could you post your comment as an answer so i could mark it answered as this was exactly the case. I'm not sure but i think a token of one of the Android devices registered wrong because on a reinstall and a batch send the Android side gave the exact same message. – D.Slutter Apr 07 '20 at 15:05

0 Answers0