Search code examples
windowscordovapush-notificationwns

Push Notification in Windows App - How can I change the content of the Toast Message?


I have a Windows App developed with Cordova. I registered it with my Windows Developer Account and got my token etc. Now when I send a push message (toast) via Fiddler to the App, which is currently installed on an Windows Phone 8.1, I receive the Notification on the Phone just fine - but it only says 'New Notification'.

I used this xml for the message:

    <?xml version="1.0" encoding="utf-8"?>
    <wp:Notification xmlns:wp="WPNotification">
        <wp:Toast>
            <wp:Text1>Test Message</wp:Text1>
            <wp:Text2>XXX</wp:Text2>
        </wp:Toast>
    </wp:Notification>

However, neither Text1 nor Text2 show up in my notification. How can I implement the toast notification to actually use the content from the push notification?

Since my application is written in Angular JS, I can not use any C# documentations on the topic.

Any help with this problem would be much appreciated. Thanks in advance!


Solution

  • It looks like you're using the MPNS format for toasts, but trying to push using WNS (I assume). Make sure you use the WNS toast format, documented here. Your toast should be formatted something like this:

    <toast>
        <visual>
            <binding template="ToastText02">
                <text id="1">Test Message</text>
                <text id="2">XXX</text>
            </binding>
        </visual>
    </toast>