question

HareshHanat-1975 avatar image
0 Votes"
HareshHanat-1975 asked ajkuma-MSFT answered

Notification hub: Installation templates not created again once deleted registrations

Endpoint - PUT https://{namespace}.servicebus.windows.net/{NotificationHub}/installations/{id}

Once the user registers with Device A, We create push notification templates with the above endpoint(Working properly and registering templates): Request body:

{
"installationId": "85c00d7d-1fcb-94ad-a394-59b42b24428d",
"pushChannel": "ckdcS-wPD6Wiv7r2HJls2J4Zr4ocj-nXLHP1iJGNWx7w-FsFkgK7ZpdMEm8k4Eo",
"platform": "gcm",
"templates": {
"mesaageTemplate": {
"body": "{\"data\":{\"notId\":\"#(notId)\",\"title\":\"$(title)\",\"body\":\"$(body)\",\"badge\":\"#(badge)\",\"pageName\":\"$(pageName)\",\"pageParams\":\"$(pageParams)\",\"image\":\"twitter\",\"image-type\":\"circle\",\"style\":\"inbox\"}}",
"tags": [
"User_123456"
]
}
},
"secondaryTiles": {}
}
Again user registers with Device B, we delete the existing templates of that user(Device A) and register new templates for Device B -Working properly.

Again, the User login with Device A, the endpoint is not creating the template registrations in the notification hub. (It is sending the same installation id when user logged in with Device A the first time) - Not Registering

can you suggest a way to resolve this?

azure-notification-hubs
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

HareshHanat-1975, Thanks for posting this question.

I see that you have also posted this question on SO and you're referring to this doc for the steps, I'm checking on this and will get back to you shortly.


As required, I shall reach out to you privately to get more details about your App and subscription.

P.S. Kindly do not post any PII data on the public forum.

0 Votes 0 ·

@HareshHanat-1975, Just following-up: Installations and Registrations are tied directly to a device with the push channel being the way NH communicate with the PNS. Could you please share more information on why you're switching between devices? What specific scenario (setup) are you attempting you accomplish?

Notification Hubs pushes notifications to a device.
142132-image.png


0 Votes 0 ·
image.png (17.7 KiB)

@ajukuma-MSFT, we have some cases, like once user install the app on Device A and then install on another device B for some reason. Which is working properly. When user register another device we delete the notification hub registrations for Device A as we don't want to send the notification to old device.

After this, if user login again with Device A then we call the mentioned endpoint to re register the notification templates and registrations. But, it is not registering again. And we are not able to send the notification to user. Which should be..

Thanaks

0 Votes 0 ·

HareshHanat-1975, Apologies for the delay in responding here. As I understand, you had a discussion on this scenario internally with our product team.
As mentioned, Installations and Registrations are tied directly to a device with the push channel, it's the way Notification Hub communicates with the PNS. I'm discussing further on this and will get back to you shortly.

0 Votes 0 ·

1 Answer

ajkuma-MSFT avatar image
0 Votes"
ajkuma-MSFT answered

HareshHanat-1975, Apologies for the delay! Following-up from our discussion in the comments.

Just to highlight on the difference on installation vs registration: The installation or registration (depending on the API you are using), is tied uniquely to a single device through its Platform Notification Service (PNS) unique ID.

If you have two devices, this means that you will have two different installations/registrations.

You shared some insights on your scenario in your previous comment, "we have some cases..," However, we would like to understand more insights/details on your scenario- why the installation/registration will be deleted if the app is installed on a new device and what the requirement is for this functionality?
Do you mean that the app can only be installed once per user and only on one device?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.