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