首页 文章

如何从azure发送推送通知到Windows mobile cordova应用程序

提问于
浏览
0

嗨,我正在使用azure进程将推送通知发送到版本混合应用程序上方的Windows 10,我使用下面的代码发送通知

https://docs.microsoft.com/en-us/azure/app-service-mobile/app-service- mobile-cordova-get-started-push

我在这里得到了这个文件pushRegistration.on('registration',function(data){这个方法没有触发是否有任何进程注册之前发送通知

1 回答

  • 1

    您必须实现registerForPushNotifications方法,并在每次用户打开App时调用它:

    var pushRegistration = null;
     function registerForPushNotifications() {
       pushRegistration = PushNotification.init({
           android: { senderID: 'Your_Project_ID' },
           ios: { alert: 'true', badge: 'true', sound: 'true' },
           wns: {}
       });
    

    如果未调用pushRegistration.on,则可能是注册未完成或存在错误 . 创建断点或在以下位置打印一些消息:

    pushRegistration.on('error', handleError);
    

    看看是不是错了 .

    此外,您可以检查通知中心诊断指南后是否有一些丢失的配置:https://docs.microsoft.com/en-us/azure/notification-hubs/notification-hubs-push-notification-fixer

相关问题