0

因此,如果我有自己的游戏和服务器,我如何从我的服务器向该设备发送推送通知,您知道应用程序读取消息并将其显示在屏幕上吗?

抱歉,在推送通知方面,我是个菜鸟。

4

3 回答 3

2

你是从哪里开始找的?

Windows Phone 7 支持几种不同的通知,例如 Toast、Live Tiles、Raw 等。

我建议从这里开始并阅读更多关于它们的内容,并点击相应文档和示例的链接。

于 2011-05-22T16:48:40.083 回答
1

我正在向您发送 toast 推送通知的工作代码。

String toastMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
 "<wp:Notification xmlns:wp=\"WPNotification\">" +
     "<wp:Toast>" +
          "<wp:Text1> Welcome To Windows Push &lt;/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();
于 2012-11-07T10:08:40.307 回答
0

是的,您可以发送,但为什么要发送推送通知?为此使用动态磁贴通知。使用 Windows phone 工具包中的 hubtile 并将 Hub 添加到 Visual 树,然后执行 hubtile1.Notification ="Something you want to send as push notification";

于 2013-07-20T06:26:47.520 回答