WNS Push notification does not work even with status 200

I am 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 . Now I can not receive push notifications on my devices, but WNS servers respond to me with a status of 200 and a received message

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 header (looped in php):

 [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 test xml payload:

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

Thus, it is obvious that my request is fine for the server, but nothing was sent to the device (neither with the closed application, nor with the running application with the corresponding event related to pushnotificationreceived). I also checked this list https://msdn.microsoft.com/en-us/library/windows/apps/dn457490.aspx#push_200_OK , but without success, it seems (to me) that everything is set up fine. I’m literally mad at this, I don’t know where the mistake really is. Has anyone had the same problem? thank you very much

+6
source share
2 answers

I had the exact problem, spending several hours reading and trying a lot of things, which I finally found the problem. In the package manifest for the WP8.1 application, there is an option to enable toast notifications on the Application tab; you need to explicitly set "Yes".

A man who was upset because there was no indication that it didn’t work!

+1
source

I also had a lot of problems with push notifications.

  • As far as I understand, do you have an App Store app?
  • Uninstall the application and get a new device URI.
  • Only send Authorization and X-WNS-Type headers.
  • My working example is <?xml version=\"1.0\" encoding=\"utf-16\"?><toast><visual><binding template=\"ToastImageAndText01\"><image id=\"1\" src=\"\"/><text id=\"1\"></text></binding></visual></toast>
0
source

Source: https://habr.com/ru/post/983966/


All Articles