Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WNS Push notification not working even with status 200

I'm working on push notifications through WNS and WINJS (windows Phone 8.1). I followed this article https://msdn.microsoft.com/en-us/library/windows/apps/hh465460.aspx. Right now i can't receive push notifications on my devices, but the WNS servers answer me with status 200 and message received

HTTP/1.1 200 OK
Content-Length: 0
X-WNS-DEVICECONNECTIONSTATUS: connected
X-WNS-NOTIFICATIONSTATUS: received
X-WNS-STATUS: received
X-WNS-MSG-ID: 77B3599101A23AB8
X-WNS-DEBUG-TRACE: DB3WNS2010831
Strict-Transport-Security: max-age=31536000; includeSubDomains
Date: Wed, 18 Mar 2015 13:58:29 GMT

My request's header (looped in php) is:

[0] => Content-Type: text/xml
[1] => Content-Length: 142
[2] => X-WNS-TTL: 3600000
[3] => X-WNS-Type: wns/toast
[4] => X-WNS-RequestForStatus: true
[5] => Authorization: Bearer EgAeAQMAAAAEgAAAC4AA90q2GTPfvxMbeV....

My xml test payload is:

<toast>
  <visual lang="it-IT">
    <binding template="ToastText02">
       <text id="1">Hello</text>
    </binding>
  </visual>
</toast>

So apparently for the server, my request is fine, but nothing is sent to the device (neither with closed app or running app with associated pushnotificationreceived event). I also checked this list https://msdn.microsoft.com/en-us/library/windows/apps/dn457490.aspx#push_200_OK , but with no success, it seems (to me) that everything is set fine. I'm literally getting mad at this , I don't know where the error really is. Anyone had the same problem? thanks a lot

like image 450
user3589246 Avatar asked Mar 18 '15 14:03

user3589246


1 Answers

I had the exact issue, after spending several hours reading and trying numerous things I finally found the problem. The package manifest for the WP8.1 app has an option for enabling toast notifications, under Application tab; you need to explicitly set "Yes".

Man, that was frustrating as there was no indication of what was failing!

like image 95
Andrei Borodin Avatar answered Oct 05 '22 23:10

Andrei Borodin