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.
source share