我是windows phone开发和推送通知的新手。我已经在我的应用程序中实现了pushwoosh通知。我按照文档PushWoosh WP收到了通知,但通知栏上没有显示确切的通知文本。我只收到了“新通知”
这是我的代码。
private async void OnPushNotification(PushNotificationChannel sender, PushNotificationReceivedEventArgs e)
{
String notificationContent = String.Empty;
switch (e.NotificationType)
{
case PushNotificationType.Badge:
notificationContent = e.BadgeNotification.Content.GetXml();
break;
case PushNotificationType.Tile:
notificationContent = e.TileNotification.Content.GetXml();
break;
case PushNotificationType.Toast:
ToastTemplateType toastType = ToastTemplateType.ToastText02;
XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(toastType);
toastXml = e.ToastNotification.Content;
XmlNodeList toastTextElement = toastXml.GetElementsByTagName("text");
toastTextElement[0].AppendChild(toastXml.CreateTextNode("eg"));
//toastTextElement (toastTextElement[0] as XmlElement).InnerText = message;
IXmlNode toastNode = toastXml.SelectSingleNode("/toast");
((XmlElement)toastNode).SetAttribute("duration", "long");
ToastNotification toast = new ToastNotification(toastXml);
ToastNotificationManager.CreateToastNotifier().Show(toast);
break;
case PushNotificationType.Raw:
notificationContent = e.RawNotification.Content;
break;
}
e.Cancel = true;
}我试着获取准确的推送消息,但做不到..请参阅附件中的SS以了解钙化情况。


为什么我的包名在头中,但没有图像?为什么不显示真正的消息,而不是新通知?有人能帮我解决这个问题吗?提前谢谢你。
发布于 2017-04-11 20:08:10
请注意,对于Windows Phone 8.1及更高版本的Pushwoosh SDK集成流程与您之前遵循的流程不同:
http://docs.pushwoosh.com/docs/windows-8-sdk-integration
这是由于WP8.1使用WNS (Windows Push Notification ServiceS)进行推送消息传递,而不是WP8.0和更早版本上使用的MPNS。请注意,MPNS仍然可以向后兼容-这就是为什么你仍然会收到通知,但是它的内容应该是不同的,以显示在WP8.1设备上,特别是它应该是XML或原始内容编码在MIME的base64中的对象( language1:'content1',language2:'content2‘)或字符串的形式。
如果你通过Pushwoosh Remote API发送推送,你应该在"wns_content“中指定通知文本,而不仅仅是在”content“中:
"wns_content": { "en": "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48YmFkZ2UgdmFsdWU9ImF2YWlsYWJsZSIvPg==", "de": "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48YmFkZ2UgdmFsdWU9Im5ld01lc3NhZ2UiLz4=" }
如果您通过Pushwoosh Dashboard发送通知,则应在单独的Windows选项卡中撰写邮件:

https://stackoverflow.com/questions/42934626
复制相似问题