none
Windows Azure node.js Push notification for Windows store 8.1 - How to use 'createRawTemplateRegistration' template?

    Question

  • Please explain with one example as I am getting Error: 400 - The specified resource description is invalid.

    Basically, I want to update badge value. But there is no template for badge registration in WnsService API document. So, I am trying with "createRawTemplateRegistration" template to update the badge value. Please help me on this.

    Tuesday, June 21, 2016 10:51 AM

All replies

  • To update badge you can use BadgeUpdateManager of BadgeNotifications

    https://msdn.microsoft.com/en-us/library/windows.ui.notifications.badgenotification.aspx


    http://www.dotnetspeaks.com

    Tuesday, June 21, 2016 11:01 AM
  • BadgeUpdateManager class is used to update the badge from inside the application.
    I want to update the badge from outside the application i.e. on receiving the push notification. So we are using azure mobile services for that purpose.
    Tuesday, June 21, 2016 11:17 AM
  • You need to implement Raw notification with BackgroudTask as PushNotificationTrigger.

    This sample code may help.

    https://code.msdn.microsoft.com/windowsapps/Raw-notifications-sample-3bc28c5d


    http://www.dotnetspeaks.com

    Tuesday, June 21, 2016 11:27 AM
  • Thanks Sumit. 

    I was aware of this solution.
    But is there a other way to update badge value? or creating BackgroundTask is the only solution to update the badge value ?
    Tuesday, June 21, 2016 11:33 AM
  • I am not able to register the application for Raw push notification also.

    I am using 'createRawPushNotification' template from the API documentation of Azure push notification using Node.js. But I am getting an error regarding template. Its template given in the document is like this 

    createRawTemplateRegistration(channel, tags, template, optionsOrCallbackopt, callback) 

    But it's not explained with an example which I wanted.

    Tuesday, June 21, 2016 11:40 AM
  • This is the only way I think as per the documentation

    https://msdn.microsoft.com/en-us/windows/uwp/controls-and-patterns/tiles-and-notifications-raw-notification-overview

    Can you post your template?


    http://www.dotnetspeaks.com

    Tuesday, June 21, 2016 12:16 PM
  • Please go through this link to get an idea of registration template used for Azure push notification.

    http://azure.github.io/azure-sdk-for-node/azure-sb/latest/WnsService.html

    • Edited by Nikhil1029 Wednesday, June 22, 2016 6:39 AM
    Wednesday, June 22, 2016 6:38 AM
  • I am aware of the template, the reason I asked to post your template is you might get error if Template structure is wrong.

    http://www.dotnetspeaks.com

    Wednesday, June 22, 2016 6:42 AM
  • Ok. This is the template.

    hub.wns.createRawTemplateRegistration(pushIdentifier, [userId, platform, version, tag], templateMessage, 'wns/badge', registrationComplete)

    Here I am confused about the "templateMessage" argument. Could you please help me with that? What should the format of templateMessage if I want to update the badge.

    For your referrence, this is the toast registration template which is working fine and app receives toast.

    templateMessage = { text1: '$(message)' };

    hub.wns.createToastText01Registration(pushIdentifier,
                        [userId, platform, version, tag], templateMessage, registrationComplete);

    Wednesday, June 22, 2016 9:30 AM
  • @Sumit Dutta1 Awaiting your reply.

    Please help me if you know the solution
    • Edited by Nikhil1029 Thursday, June 23, 2016 11:49 AM
    Thursday, June 23, 2016 9:03 AM