Push Notification not hitting Windows Phone 8.1RT app?

I am developing to send push notifications, everything works fine and the response also gets "OK". But I couldn't get any notifications. Are there any changes to my device settings? Please help me.

Below is my code:

I am getting the channel from this code:

 var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
 var jj = channel.Uri.ToString();

      

My service code:

string subscriptionUri = "https://hk2.notify.windows.com/?token=rretetretretretretretrergtrgtrgtrg43589743cn43jr43jr43jr4rvr43ro045jv77nninuoinjyt";

string PushNotificationXML = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                             "<wp:Notification xmlns:wp=\"WPNotification\">" +
                             "<wp:Tile>" + "<wp:BackgroundImage>" + "sdfsafdsafsdf" +
                             "</wp:BackgroundImage>" + "<wp:Count>" + 
                             "0" + "</wp:Count>" + "<wp:Title>" +
                             "Hi This is pavan" + "</wp:Title>" +
                             "</wp:Tile> " + "</wp:Notification>";

string strChannelURI = subscriptionUri;

//string secret = "xxxxxxxxxxxxxxxxx";
//string sid = "ms-app://s-1-15-2-23454435445-4343434-4343434443434-343434343-334-343443434-3434344443";
var accessToken = GetAccessToken(secret, sid);

byte[] contentInBytes = Encoding.UTF8.GetBytes(PushNotificationXML);

HttpWebRequest request = HttpWebRequest.Create(subscriptionUri) as HttpWebRequest;
request.Method = "POST";
request.Headers.Add("X-WNS-Type", "wns/badge");
request.ContentType = "text/xml";
request.Headers.Add("Authorization", String.Format("Bearer {0}", accessToken.AccessToken));

using (Stream requestStream = request.GetRequestStream())
    requestStream.Write(contentInBytes, 0, contentInBytes.Length);

using (HttpWebResponse webResponse = (HttpWebResponse)request.GetResponse())
    webResponse.StatusCode.ToString();

      

The answer is "OK", but I could not get notifications about my device.

0


source to share





All Articles