Introduction
I'm working on a backend which is used by iOS and Android mobile apps and have decided to use Azure Notification Hubs for push notifications. It is written in .NET and uses device registration from a backend (Registration).
User is able to use same application on multiple devices at the same time and requirements are that users should be able to receive notifications on all devices. There is also possibility that multiple users will use app on the same device - authentication is done using username and password.
Registrations are saved in DB table which stores:
- registrationId
- platform
- reference to user
This makes it possible for the same user to receive notifications on multiple devices.
Registration
Registration is done in the following way on the iOS device:
- App is started
- PNS handle is received from APNS (token)
- Username and password are entered
- App asks for RegistrationId from backend
- RegistrationId is saved to local storage
- Registration is performed using RegistrationId, Handle and Platform parameters which are sent to Web API endpoint
- Tag "username:test1" is added so notification can be sent to specific user
Problem(s)
I've noticed that PNS Identifier is same for two (or more) registrations (please see screenshot). Developer which is working on the iOS app pointed to the following question: Obtain NEW Apple device token?
Is it valid to have same PNS Identifier for multiple installations provided that I have unique tags?
If there are multiple duplicates of PNS Identifier application would display multiple notifications (notifications are filtered by tag "username")?
Should the PNS Identifier be unique for app, device or user?