I've setup a Mobile App on Azure and configured push notifications with a newly created Notification Hub.
So far I have only implemented the iOS client, following the guides over here and it registers itself successfully. I can go over to the Azure Portal and send a test notification and sending from my own code also works.
In VS I inspected the registered devices and see the following:
Two registrations have been made, both for the same device (the PNS is the same), the registrations IDs are different.
If I test send via the portal, the message is delivered to the registration that says "Native". If I send via the backend, it will send to "Template".
- What are these two registrations?
- Why are different registrations used depending on where I send from?
To send the message from code I'm using:
var result = await
hub.SendTemplateNotificationAsync(templateParams).ConfigureAwait(false);
And as mentioned above, the result details will show one successful delivery to the "Template" registration.
The client registers itself like this:
const string templateBodyAPNS = "{\"aps\":{\"alert\":\"$(messageParam)\"}}";
var templates = new JObject();
templates["genericMessage"] = new JObject
{
{"body", templateBodyAPNS}
};
await push.RegisterAsync(deviceToken, templates);