Smith Jones
Smith Jones

Reputation: 11

Notification messages delivered to the Azure Notification Hub are not reaching the device(Android)

I need the Notification Message Id that is supposed to be returned from the azure notification hub when sending the message.

I am sending the message from the app backend using the SendGcmNativeNotificationAsync method.

NotificationOutcome outcome = await hub.SendGcmNativeNotificationAsync(notif, tags);

After sending the notification, the outcome.NotificationId property is empty or null. How can I get the Notification Id?

Although the outcome.Result[0].Outcome received has value

"The Notification was successfully sent to the Push Notification System"

but the notifications are not delivered to the registered device.

Also I get a tracking id in outcome.trackingid how can I use it to track the message.

I am using free version of azure portal.

Please suggest

Thanks in advance!

Upvotes: 1

Views: 911

Answers (1)

Marcel Wolterbeek
Marcel Wolterbeek

Reputation: 3702

It took me quite some time to figure this out, because it is not clear documented, but the answer is simple: NotificationOutcome.NotificationId is always null when Azure pricing tier is not S1 (Standard).

To figure out the cause of your problem, temporary switch to the S1 pricing tier. Then you will get the NotificationId and Azure will register Per Message Telemetry.

In theory, you should be able to get the results by calling GetNotificationOutcomeDetailsAsync with the NotificationId to get more error info. It can take up to 30 minutes (!) before this call succeeds (if you call it too soon you get a MessagingEntityNotFoundException).

Unfortunately, the result State is mostly Completed, even though the message had a wrong or expired device ID.

The results in the Metrics shown in Azure for your Notification Hub are correct, but I did not find a reliable way yet to retrieve the results on a Per Message base.

Don't forget to switch back to the F1 (Free) pricing tier!

Upvotes: 1

Related Questions