How to find out which device is registered for which user for sending apple native notification?
I am getting all the devices registered in my notification hub with:
var allRegistrations = await _hubClient.GetAllRegistrationsAsync(0);
but this has no information about the users.
2
Answers
You can make use of tags for that. Get the devicetag in app.component.ts
and store it in the database along with the user information. That way, if you want to send notifications to particular user, you can get the device tag from the database of that user and send notification to that particular user.
To establish which user is linked with a certain registration, utilize the
UserInformation
attribute of eachNotificationHubRegistration
object.If you need to identify the device linked with each user, you may record the registration ID and device ID for each user in a dictionary or other data structure. The registration ID may then be compared to the list of devices registered to the notification hub to locate the appropriate device.