Search code examples
azurewindows-phone-8notificationswindows-phone-8.1azure-notificationhub

Registering Two templates with Notification hub and send Notifications


Motive :- I want to send the both Toast and Tile Notification Simultaneously to my Windows Phone 8.1 App.

=> I am using Templates Feature with Notifications Hub to send the localized notifications.

Everything is working fine When I register only Toast/Tile Templates(One at a time) with Notificationhub Client.

await _hubClient.CreateWindowsTemplateRegistrationAsync(model.ChannelUri, toasttemplate, tags);

Problem :- But when i register the Both Toast and Tile Templates With hub then in that case it is not able send Both notifications. There is no error indication..

So anybody know how can register and send both notifications simultaneously ? Any pointer or help is really appreciated.


Solution

  • I have posted my answer on microsoft forms Get a hint from there, It is working fine, Reference :- Microsoft Notification Forum

    It is little bit less understandable but i am adding some stuff in support of forum answer.

    • Template registrations will be differentiated with reference to set of tags they are registered with. For example, suppose you are registering a set of same tags with both the Tile and Toast Notifications template registration, in that case Notification hub would not be able to differentiate which type of notification you are sending.

    Solution :- when you are registering with notification hub just add a extra new tag i.e. for toast = "toast" and for tile = "tile", for differentiating two different registrations. And when you are sending the notification to devices, you have to use Tags Expression for targeting the Toast and Tile differently. For Example :- For sending toast notification to tag1 you have to use "tag1&&toast" expression. For Tile you have to use "tag1&&tile".

    I have spent a lot of time to made the both notifications work simultaneously, Just go through with this answer and Forum answer. You will get your solution.

    Hope it'll help somebody.