0
A
回答
2
1
我向您发送吐司推送通知的工作代码。
String toastMessage = "<?xml version=\"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();
+0
我们可以从应用程序发送推送通知给自己吗? – 2013-04-26 06:57:13
0
是的,你可以发送,但你为什么要发送推送通知?使用活动磁贴通知。 从Windows手机工具包使用hubtile并将Hub添加到Visual树中,并执行 hubtile1.Notification ="Something you want to send as push notification";
相关问题
- 1. 推送通知Windows Phone 7
- 2. 发送从Windows Phone设备到webservice的推送通知
- 3. 设备上的Windows Phone推送通知
- 4. 发送推送通知到iOS设备
- 5. 发送GCM推送通知到设备
- 6. Windows Azure移动服务 - 推送通知没有发送到Windows Phone 8设备
- 7. Windows Phone 7.x本地推送通知
- 8. 推送通知为Windows Phone 7
- 9. 使用java发送Windows Phone 7的推送通知
- 10. Windows Phone 8推送通知
- 11. windows phone 8.1推送通知
- 12. Appcelerator Windows Phone推送通知
- 13. Parse.com:从设备发送推送通知?
- 14. 尝试将推送通知发送到iOS设备 - 未收到推送通知
- 15. 直接从设备发送苹果推送通知到设备
- 16. 如何从Windows Phone 7的推送通知发送到.NET WinForm应用程序
- 17. Windows Phone中的推送通知
- 18. pushChannel在windows phone 8.1设备中始终为空(推送通知)
- 19. Windows Phone推送通知多个设备在一个请求中
- 20. 通过asp.net发送推送通知windows phone 8
- 21. 设置AWS SNS将推送通知发送到iOS设备
- 22. 无法通过APNS将MDM推送通知发送到设备。
- 23. Windows Phone 7:推送通知在模拟器上工作,不在设备上
- 24. 推送通知:如何使用Pubnub向特定设备发送推送通知?
- 25. 无法使用Azure.NotificationHubs SDK发送Windows Phone推送通知
- 26. 如何通过Firebase将设备发送到设备推送通知
- 27. 发送带有证书的Windows Phone推送通知?
- 28. 将推送通知发送到新注册的设备
- 29. 发送SNS推送通知消息到多个设备
- 30. Android GCM推送通知 - 将消息发送到一组设备
谢谢我检查链接现在;)我会使用Raw。 – me101 2011-05-22 16:49:29