Blog Home  Home Feed your aggregator (RSS 2.0)  
Mayur's Blog - How to register a device with tags using Microsoft.WindowsAzure.MobileService.Push.RegisterAsync (string registrationId, JObject templates) ?
 
# Thursday, October 20, 2016

Are you experiencing the same what I have just experienced? I wanted to register a device using Push.RegisterAsync(string regiId, JObject templates) with tags. I could not find any explanation on the signature of templates object required as one of the parameters of this method.

When I looked into GitHub to check the source to figure out the issue, I was able to locate the correct format of this templates object.

push.RegisterAsync(.., ..) method eventually calls the following controller

https://github.com/Azure/azure-mobile-apps-net-server/blob/master/src/Microsoft.Azure.Mobile.Server.Notifications/Controllers/NotificationInstallationsController.cs

This controller has two parameters. One of them is an object of the following class

https://github.com/Azure/azure-mobile-apps-net-server/blob/master/src/Microsoft.Azure.Mobile.Server.Notifications/NotificationInstallation.cs

So, to provide tags correctly, a client must provide a valid instance of NotificationInstallation. You may want to use the public property named "Tags" here and provide a list of tags. However, this would still not work because of the following bug. I have created this issue within project Microsoft.Azure.Mobile.Server.Notifications on GitHub. I am yet to hear something from the project moderator or members. So I don't know whether what I have proposed is correct or not.

Azure/azure-mobile-apps-net-server#162

However, I needed to complete my work so I implemented my own version of NotificationInstallationsController to fix the issue. It works for me indeed. So I think that what I have proposed should be correct.

I am adding this explanation here, in case, if some one is having the same problem and looking for any solution, then this would help. If you need further information, please let me know.

Thursday, October 20, 2016 6:42:56 PM UTC  #       | 
Copyright © 2020 Mayur Bharodia. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: