Registration Time at Azure Notification Hubs (90 days)

Now I use the PushSharp library to send Apple push notifications (via APNS), but I want to upgrade to Notification Hubs for reliability and scalability.

I plan to implement sending notifications through Azure notification hubs using backend registration, as described in this article . So:

  • There is a backend API method that the iOS client calls when it updates the token. In this method, I register it with the user ID. (I used to save a push token for a user link in the database.)
  • When I have a notification to send for a specific user, I send it using the tag (user ID). (I used to use the APNS device token from the database.)

This seems to be a working solution, but the notification documentation says:

It is important to note that registration is temporary. Like the PNS handles they contain, registration ends. You can set the time for recording at the registration center, up to a maximum of 90 days. This limitation means that they should be updated periodically, and also that they should not be the only repository of important information. This automatic expiration also makes cleaning easy when your mobile application is uninstalled.

And that is the problem. Sometimes I need to send a notification to devices that have not updated the token within 90 days and so on. Thus, the APNS token will remain active, but the Notification Hub registration will be invalidated. Therefore, I just lose the communication channel for the user.

How do you deal with this?

Of course, I can still store tokens in the database and do work that periodically updates the registration. But this is not what you would expect from a push notification solution such as Notification Hubs.

+6
source share
3 answers

Just fast, since the answer is 2 years. In this blogpost, Azure states:

It is important to note that registration and default installation no longer ends.

I assume this makes the expire field confuse, but no longer a problem.

UPDATE

Older notification centers still have this problem. You need to update them to set the expiration to infinity, the instructions are in this forum post . New hubs are automatically set to infinity.

+2
source

You can update your registration data from the application or from your server. If you do this from your application, the application must be launched by the user in order for the registration to be updated.

Therefore, if you require that device registration remain active even for applications that have not started for more than 90 days, you need to update the registration through your server, and completing a task on your server that will update tokens seems to be your only option.

I agree that the Notification Hubs token expiration solution seems weird. Perhaps they had in mind the behavior of the Microsoft Push Notification Service (MPNS) notification channels, which expire more often than APNS device tokens or GCM registration identifiers.

+6
source

According to the latest documentation for the notification hub, this 90-day limit has increased to the life of your device, which means you don’t need to register your device after 90 days.

0
source

Source: https://habr.com/ru/post/969738/


All Articles