[英]Notification Hubs of Windows Azure for Windows phone 8 not working
你好朋友在這個通知中心上找不到Wp8鏈接。 我知道這不是一個正確的問題,但它不適用於我的情況。 我能夠看到我的sampleNotificationhub windows azure帳戶信息顯示板上的消息,但無法獲得Toast通知。
我已經檢查了連接字符串問題,以確保這是我的手機應用程序連接字符串..
var hub = new NotificationHub("samplenotificationhub", "connectionstring");
await hub.RegisterNativeAsync(args.ChannelUri.ToString());
和我的Windows商店應用程序發送Toast通知字符串是這個..
NotificationHubClient hub = NotificationHubClient.CreateClientFromConnectionString("connection string", "samplenotificationhub");
string toast = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<wp:Notification xmlns:wp=\"WPNotification\">" +
"<wp:Toast>" +
"<wp:Text1>Hello from a .NET App!</wp:Text1>" +
"</wp:Toast> " +
"</wp:Notification>";
await hub.SendMpnsNativeNotificationAsync(toast);
請你現在讓我告訴我,我所缺少的東西或者遺漏了鏈接的東西......對於任何幫助和建議表示贊賞。 我在模擬器上測試它還有一件事
您需要在XML有效負載中包含<wp:Text2 />
和<wp:Param />
元素。
wp:Param
元素可以為空,但wp:Text2
元素不能為空。
嘗試以下標記
string toastMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<wp:Notification xmlns:wp=\"WPNotification\">" +
"<wp:Toast>" +
"<wp:Text1> title </wp:Text1>" +
"<wp:Text2> subtitle </wp:Text2>" +
"<wp:Param>/Page2.xaml?NavigatedFrom=Toast Notification</wp:Param>" +
"</wp:Toast> " +
"</wp:Notification>";
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.