c# - Windows phone 8 - Sending push notification works from Web Form but not from Phone -


i made web service can send push notification depending on this tutorial. when call function web form, works perfectly. however, when call same function phone don't receive notification @ although response "received | active | connected". function :

[webmethod]     public void sendnotification(string title, string msg, string url)     {         try         {             string subscriptionuri = getnotificationurl();             httpwebrequest sendnotificationrequest = (httpwebrequest) webrequest.create(subscriptionuri);              sendnotificationrequest.method = "post";              string toastmessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +                                   "<wp:notification xmlns:wp=\"wpnotification\">" +                                   "<wp:toast>" +                                   "<wp:text1>" + title + "</wp:text1>" +                                   "<wp:text2>" + msg + "</wp:text2>" +                                   "<wp:param>" + url + "</wp:param>" +                                   "</wp:toast></wp:notification>";              byte[] notificationmessage = encoding.default.getbytes(toastmessage);              // set web request content length.             sendnotificationrequest.contentlength = notificationmessage.length;             sendnotificationrequest.contenttype = "text/xml";             sendnotificationrequest.headers.add("x-windowsphone-target", "toast");             sendnotificationrequest.headers.add("x-notificationclass", "2");                using (stream requeststream = sendnotificationrequest.getrequeststream())             {                 requeststream.write(notificationmessage, 0, notificationmessage.length);             }              // send notification , response.              httpwebresponse response = (httpwebresponse) sendnotificationrequest.getresponse();             string notificationstatus = response.headers["x-notificationstatus"];             string notificationchannelstatus = response.headers["x-subscriptionstatus"];             string deviceconnectionstatus = response.headers["x-deviceconnectionstatus"];              writelog(notificationstatus + " | " + notificationchannelstatus + " | " +                                               deviceconnectionstatus);         }         catch         {           }     } 


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -