我正在尝试像这样实现http://dotnettrain.blogspot.co.uk/2011/07/push-notifications-in-windows-phone-75.html
我在同一页面发送和接收。A.xaml
我要发送的有效负载:在 GetToastPayLoad
string message = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<wp:Notification xmlns:wp=\"WPNotification\">" +
"<wp:Toast>" +
"<wp:Text1>New Link Request</wp:Text1>" +
"<wp:Text2>"+data.Title+"</wp:Text2>" +
"</wp:Toast>" +
"</wp:Notification>";
httpRequest 的标头是:-
.........................................
var request = (HttpWebRequest)WebRequest.Create(new Uri(channelUri));
request.Method = "POST";
request.ContentType = "text/xml";
payload = GetToastPayload(data);
request.Headers.Add("X-WindowsPhone-Target", "toast");
request.Headers.Add("X-NotificationClass", "2");
}
我能够将 A.xaml 中的响应捕获为 OnToastNotificationReceived 并在消息框中的详细信息中打印。
但是当我删除事件处理程序时,我正在运行的应用程序中没有收到任何通知。
如何以正常的方式接收和显示正常的 toast 通知?
*我应该怎么做才能使这个通用,比如说我希望它显示在用户所在的任何地方:A.xaml、B.xaml、C.xaml等?*