我試圖發送推送通知給我的寡婦手機8應用程序(瓷磚通知)。這是來自MPNS的響應:通知狀態:抑制notificationChannelStatus:活動,設備連接狀態:已連接。我已經檢查了服務器響應代碼,並且發現了以下解釋:MPNS推送通知服務器返回作爲通知狀態返回抑制
推送通知已被推送 通知服務接收和刪除。如果 通知類型無法通過調用BindToShellTile或 BindToShellToast客戶端應用程序
啓用,可能會發生被抑制的狀態這是我在客戶端代碼和我打電話BindToShellTile
方法 - 它是越來越援引第一次該應用程序已安裝。
HttpNotificationChannel pushChannel;
string channelName = "TileSampleChannel";
pushChannel = HttpNotificationChannel.Find(channelName);
if (pushChannel == null) {
pushChannel = new HttpNotificationChannel(channelName);
// Register for all the events before attempting to open the channel.
pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred);
pushChannel.Open();
pushChannel.BindToShellTile();
} else {
pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred);
System.Diagnostics.Debug.WriteLine(pushChannel.ChannelUri.ToString());
MessageBox.Show(String.Format("Channel Uri is {0}",
pushChannel.ChannelUri.ToString()));
}
而且我能夠成功獲取通道URI。爲什麼我總是被壓制的狀態?我已經在設備上進行過測試,並且已經檢查過電池電量不低。該瓷磚也固定開始屏幕。
這是我的XML
string tileMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<wp:Notification xmlns:wp=\"WPNotification\">" +
"<wp:Tile>" +
"<wp:BackgroundImage>" + TextBoxBackgroundImage.Text + "</wp:BackgroundImage>" +
"<wp:Count>" + TextBoxCount.Text + "</wp:Count>" +
"<wp:Title>" + TextBoxTitle.Text + "</wp:Title>" +
"<wp:BackBackgroundImage>" + TextBoxBackBackgroundImage.Text + "</wp:BackBackgroundImage>" +
"<wp:BackTitle>" + TextBoxBackTitle.Text + "</wp:BackTitle>" +
"<wp:BackContent>" + TextBoxBackContent.Text + "</wp:BackContent>" +
"</wp:Tile> " +
"</wp:Notification>";
你可以顯示你的XML消息嗎? –
@kubakista我已經添加了我的XML .. –