Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Notification Hub registrations disappear when sending a notification

Recently our Azure Notification Hub became a very mysterious entity. When Apple devices register we can see them in Service Bus Explorer and as soon as we try sending any notifications (from SBE or Azure Portal) we get a "Notification Successful" message, but nothing appears on the device. Refreshing registration list uncovers the fact that the registrations were deleted.

We are not removing them anywhere in code, and the TTL has not expired.

Any suggestions?

like image 885
Wojtek Turowicz Avatar asked Jan 28 '15 11:01

Wojtek Turowicz


People also ask

How do I send an azure notification?

To set up Windows Push Notification Service (WNS): In the Azure portal, on the Notification Hub page, select Windows (WNS) from the left menu. Enter values for Package SID and Security Key. Select Save.

How does Azure notification hub work?

Azure Notification Hubs is a massively scalable mobile push notification engine for quickly sending millions of notifications to iOS, Android, Windows, or Kindle devices, working with APNs (Apple Push Notification service), GCM (Google Cloud Messaging), WNS (Windows Push Notification Service), and more.

Which Azure Service send push notifications to any platform from any back end?

Azure Notification Hubs provide an easy-to-use and scaled-out push engine that enables you to send notifications to any platform (iOS, Android, Windows, etc.) from any back-end (cloud or on-premises). Notification Hubs works great for both enterprise and consumer scenarios.

Is Azure notification hub free?

Notification Hubs is offered in three tiers—free, basic and standard. Base charge and quotas are applied at the namespace level. Pushes exceeding included amounts are aggregated at the subscription level for each tier.


3 Answers

Notification hub cleans up registrations with invalid tokens during the send flow. Looks like for some reasons APNS rejects your tokens and NH just removes registrations. Make sure:

  1. you are getting token from physical device (not emulator);
  2. APNS certificate uploaded to NH is not expired;
  3. APNS certificate uploaded to NH corresponds APNS endpoint you are using in application (sandbox or production).
like image 193
efimovandr Avatar answered Oct 07 '22 12:10

efimovandr


Turns out the front end guys were unsubscribing too eagerly. Removing the unsubscribe code sorted out the issue. Also there was a problem with the APNS certificate, in order to run the front end app in debug it requires a sandbox certificate, not a production one, for the messages to be delivered properly.

like image 39
Wojtek Turowicz Avatar answered Oct 07 '22 13:10

Wojtek Turowicz


We had this exact error, but it turned out we were accidently using a "distribution" provisioning profile with a "development"/ sandbox push notification certificate. After switching to a development provisioning profile, push notifications worked!

like image 1
r590 Avatar answered Oct 07 '22 12:10

r590