【发布时间】:2013-10-31 11:38:21
【问题描述】:
我正在尝试将推送通知发送到我的寡妇手机 8 应用程序(平铺通知)。这是来自 MPNS 的响应:通知状态:抑制 notificationChannelStatus :Active, deviceConnectionStatus:Connected。我查看了服务器响应码,发现如下解释:
Push 收到并删除了推送通知 通知服务。如果 通过调用 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 ..
标签: c# windows-phone-8 push-notification mpns