Azure notification hubs - uninstall application

I would like to use Azure notification hubs to send push notifications to users of my application running through iOS, Android and Windows Phone.

I managed to get the basics, but I don’t know how to manage the application deletion history.

When launched, the mobile application will call my Svc ID to get the Auth token. He then calls his platform alert service (e.g. Google Cloud Messaging, APNS) to get a PNS token. After storing the token in local storage, it will invoke Svc feedback to register the client device. This service will create an Azure Notification Hub subscription for the device.

This is shown in the following diagram:

enter image description here

Later, the publishing service in the background will call the contact service requesting a push notification for a specific user ID. The contact service will look for the identifier assigned to the tag in the notification hub and send a push request.

What options are available to determine when a client uninstalls an application? Is it just a question of catching errors when you call "Submit" in the notification center? I suppose this might work if sent to only one user, but I want some types of messages to be published to multiple subscribers. Upon initial registration of the device, a subscription will be created for the user identifier tag, as well as for a more general tag, such as "New Promotion". Later, the publishing service will want to issue a New Promotion notification to all devices.

+2
source share
1 answer

Why do you need to know how to uninstall applications?

Notification centers automatically terminate registration for devices that are deleted. Also, I would not leave PNSHandles in your service at all.

Current recommendations for using hubs are as follows:

Store registration data of registrations associated with the device in local storage. This allows you to update tags and channel information with a single update call. Since mobile connections are not always reliable, it is better not to create a new registration without storing the registration in local storage. This can cause the device to register several times, which will lead to duplicate notifications. You can achieve this using registration creation identifiers and creating or updating REST APIs. The first API returns the registration without actually creating the registration. When the identifier has been securely stored in the device’s storage, the device can call the create or update registration API.

Thus, I would add that your ContactSvc displays two functions: a) create a registration identifier (just call the hub to get it) b) create or update a registration (registrationId, pnsHandle, tags?)

Then your device stores regId in its storage, an ad after receiving the descriptor from PNS, if a new one with endpoint a) is not created in regId, and then updates the registration using pnsHandle and tags.

Please note that in this way your service does not need to save handles or UUIDs, and you do not need to worry about uninstalling applications.

If you track users, one approach is to periodically (once a month?) Check your hub if its registrations still exist ...

You can contact me at @eliodamaggio if this is not clear.

+4
source

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


All Articles