Windows 通知 (WP 8.1) - 无法从客户端移动应用程序连接到 WNS

Windows notifications (WP 8.1) - Unable to connect to WNS from client mobile app

我想在我的 windows 移动应用程序中实施 windows 通知。

我的移动应用程序基于:

为了实现此功能,我使用了 cordova 插件 "phonegap-push-plugin"(版本 1.4.5)。

第一次启动我的移动应用程序时,我要求我的应用程序连接到通知客户端平台。目标是此通知客户端平台要求 WNS return 我的应用程序的新通知通道(URI 形式)。

当我使用 PushNotification 中的方法 "registration" 时 class :

 var push = PushNotification.init({
         "windows": {} 
 });

 push.on('registration', function(data) {
       console.log("registration event");
       document.getElementById("regId").innerHTML = data.registrationId;
       console.log(JSON.stringify(data));
 });

我收到这个错误:

The notification client platform is unable to connect to the cloud notification service

我以为通知客户端平台目前正在维护中。我找到了一个文件,其中包含 WNS 使用的 IP 地址范围。但是当我 ping 不同的 IP 地址范围时,它起作用了。

有没有人遇到过这个问题?或者有人知道如何解决它吗?

好的,感谢 pushplugin github 的一位开发人员,我发现了问题。

我没有检查我的 Windows Phone 数据服务是否被禁用。我认为默认情况下数据服务已激活。因此,我从 Windows Phone 激活了数据服务,推送通知再次起作用。

因此,在执行推送通知方法之前,我们必须验证您的 Windows Phone 上的数据服务已激活。

还要检查您的代码错误,并从此处的 Microsoft 通知 API 中验证它的含义:PushNotificationChannelManager