windows phone 应用中未收到推送通知

Push notification is not received in windows phone app

我正在尝试使用 IBM MobileFirst Platform Foundation 6.3 为 windows phone 实施推送通知。

我从 ibm 开发人员页面 here 下载了推送通知示例应用程序,并将其安装在我的设备上。我正在尝试使用未经身份验证的 MPNS。

我可以通过调用适配器将通知发送到 Android 应用程序,但不能发送到 windows 应用程序。 MobileFirst 控制台显示已发送的消息数,但收到了 none 条消息。

我是否需要在 windows 开发人员控制台中提交我的应用程序才能使用未经身份验证的推送通知

以下是来自 visual studio 的日志。

'TaskHost.exe'(CoreCLR:默认域):已加载 'C:\windows\system32\mscorlib.ni.dll'。跳过加载符号。模块已优化,调试器选项 'Just My Code' 已启用。 'TaskHost.exe'(CoreCLR:Silverlight AppDomain):已加载 'C:\windows\system32\System.Windows.RuntimeHost.ni.dll'。跳过加载符号。模块已优化,调试器选项 'Just My Code' 已启用。 'TaskHost.exe'(CoreCLR:Silverlight AppDomain):已加载 'C:\windows\system32\System.Windows.ni.dll'。跳过加载符号。模块已优化,调试器选项 'Just My Code' 已启用。 'TaskHost.exe'(CoreCLR:Silverlight AppDomain):已加载 'C:\windows\system32\System.Net.ni.dll'。跳过加载符号。模块已优化,调试器选项 'Just My Code' 已启用。 'TaskHost.exe'(CoreCLR:Silverlight AppDomain):已加载 'C:\windows\system32\System.ni.dll'。跳过加载符号。模块已优化,调试器选项 'Just My Code' 已启用。 'TaskHost.exe'(CoreCLR:Silverlight AppDomain):已加载 'C:\windows\system32\System.Xml.ni.dll'。跳过加载符号。模块已优化,调试器选项 'Just My Code' 已启用。

MPNS 通知有 3 种类型 -

1) 原始

2) 吐司

3) 瓷砖

应用程序必须在前台才能处理原始通知。 Toast 通知是显示在 phone 显示屏顶部的基于文本的简短消息。磁贴通知可以修改用户固定到其设备快速启动区域的应用程序磁贴的外观。

WL.Server.createDefaultNotification() 的输出 JSON 包含原始和磁贴有效负载,没有 toast 有效负载。这就是为什么当应用程序处于前台时,您会注意到 pushNotificationReceived() 触发并看到推送负载。

由于默认 JSON 不包含 toast 有效负载,因此当您的应用程序处于后台时,您将看不到 toast 。如果您确实有一个磁贴固定到您的快速启动区域,您应该已经看到磁贴通知。

要获得 toast 通知,稍微修改代码 -

var notification = WL.Server.createDefaultNotification(notificationText, badgeDigit, {custom:"data"}); 

notification.MPNS.toast = {};
notification.MPNS.toast.text1 = "Toast title";
notification.MPNS.toast.text2 = "Toast content";

要查看磁贴通知,请将您的应用程序固定到快速启动区域,将应用程序置于后台,然后尝试发送通知。

API 和输出JSON 详情可见here :