0
我們可以從Linux服務器向Windows電話發送推送通知,還是隻綁定到Windows服務器?從Linux服務器向Windows電話發送推送通知
我們可以從Linux服務器向Windows電話發送推送通知,還是隻綁定到Windows服務器?從Linux服務器向Windows電話發送推送通知
嗯,我得到了答案......
做一個HTTP POST認購URI
Java代碼:
字符串toastMessage = 「?< XML版本= \」 1.0 \ 「encoding = \」utf-8 \「?>」+
"<wp:Notification xmlns:wp=\"WPNotification\">" +
"<wp:Toast>" +
"<wp:Text1> Welcome To Windows Push </wp:Text1>" +
"</wp:Toast> " +
"</wp:Notification>";
byte[] notificationMessage = toastMessage.getBytes();
url = new URL(subscriptionURI); //You must have the subscription URI provided by MPNS to client side.
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.setRequestProperty("ContentLength", String.valueOf(notificationMessage.length));
connection.setRequestProperty("ContentType", "text/xml");
connection.addRequestProperty("X-WindowsPhone-Target", "toast");
connection.addRequestProperty("X-NotificationClass", "2");
connection.connect();
DataOutputStream out =
new DataOutputStream(
connection.getOutputStream());
out.write(notificationMessage, 0, notificationMessage.length);
out.close();
這與java有什麼關係? – WeMakeSoftware
如果我們可以在java中編寫代碼來推送windows phone,那麼它可以在linux服務器上運行,並且我們可以使用java從linux服務器推送。 –
您的Web服務器數據是否轉到Windows Phone應用程序?你從服務器推送數據還是從WP7提取數據? – rishijasapara