1
votes

I want to send a push notification on Windows Phone 8.1. The notification arrives on the phone but there is no text. It just says "New Notification" and nothing happens when i press it.

I used curl to try it:

curl -v -H "Content-Type:text/xml" -H "X-WNS-Type:wns/toast"  -H "Authorization:Bearer [access_token]" -H "X-NotificationClass:2" -X POST -d "[payload]" https://db5.notify.windows.com/?token=[channel_token]

As [payload] i tried:

<?xml version="1.0" encoding="utf-8"?>
<wp:Notification xmlns:wp="WPNotification">
  <wp:Toast>
    <wp:Text1>Title</wp:Text1>
    <wp:Text2>Message</wp:Text2>
    <wp:Param>DetailView.xaml</wp:Param>
  </wp:Toast>
</wp:Notification>

and also

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

But neither works.

What am I doing wrong?

Regards Joel

1

1 Answers

0
votes

First, for WNS you need to use the second payload scheme, the first one is for the old MPNS. You could try with the following where the XML declaration is included and the quotes are escaped:

<?xml version=\"1.0\" encoding=\"utf-8\"?>
<toast launch=\"Param\">
   <visual>
       <binding template=\"ToastText02\">
           <text id=\"1\">Title</text>
           <text id=\"2\">Msg</text>
       </binding>
   </visual>
</toast>