Cordova Azure通知中心400关于推送的注册

Cordova Azure通知中心400关于推送的注册,cordova,azure,azure-mobile-services,azure-notificationhub,Cordova,Azure,Azure Mobile Services,Azure Notificationhub,我目前在Azure通知方面遇到问题-我已经为生产配置了所有内容,并通过发送测试通知确认了这一点。但是,在应用程序中的第一个“registerForPushNotifications”之后,下次打开它时,我会记录以下错误: PID[11096]信息发送响应:400.0400安装验证失败,出现以下错误: ; 提供了无效的标记“U UserId:facebook”| 10211219930003961,NewVince”。有效的标记字符为字母数字,728-8777-4cad-a475-956c3

我目前在Azure通知方面遇到问题-我已经为生产配置了所有内容,并通过发送测试通知确认了这一点。但是,在应用程序中的第一个“registerForPushNotifications”之后,下次打开它时,我会记录以下错误:

PID[11096]信息发送响应:400.0
400
安装验证失败,出现以下错误: ; 提供了无效的标记“U UserId:facebook”| 10211219930003961,NewVince”。有效的标记字符为字母数字,728-8777-4cad-a475-956c38dcde36_G6,时间戳:4/23/2017 9:09:06 AM

我正在使用提供的样板代码从cordova(ionic)应用程序注册push。我不明白我错在哪里。我想解决这个问题,因为这是目前生产中的一个问题

订阅代码:

function registerForPushNotifications() {
      pushRegistration = PushNotification.init({
        android: {
          senderID: '<id>'
        },
        ios: {
          alert: 'true',
          badge: 'true',
          sound: 'true'
        },
        wns: {}
      });

      // Handle the registration event.
      pushRegistration.on('registration', function(data) {
        // Get the native platform of the device.
        if (device) {
          debugger
          var platform = device.platform;
          // Get the handle returned during registration.
          var handle = data.registrationId;
          // Set the device-specific message template.
          if (platform == 'android' || platform == 'Android') {
            // Register for GCM notifications.
            window.azureClient.push.register('gcm', handle.replace("|",""), {
              mytemplate: {
                body: {
                  data: {
                    message: "{$(messageParam)}"
                  }
                }
              }
            });
          } else if (device.platform === 'iOS') {
            // Register for notifications.
            window.azureClient.push.register('apns', handle.replace("|",""), {
              mytemplate: {
                body: {
                  aps: {
                    alert: "{$(messageParam)}"
                  }
                }
              }
            });
          } else if (device.platform === 'windows') {
            // Register for WNS notifications.
            window.azureClient.push.register('wns', handle.replace("|",""), {
              myTemplate: {
                body: '<toast><visual><binding template="ToastText01"><text id="1">$(messageParam)</text></binding></visual></toast>',
                headers: {
                  'X-WNS-Type': 'wns/toast'
                }
              }
            });
          }
        }
      });

      pushRegistration.on('notification', function(data, d2) {
        alert('Push Received: ' + data.message);
      });

      pushRegistration.on('error', function(err) {
        console.warn("error", err)
      });
    }
函数寄存器形式通知(){
pushRegistration=PushNotification.init({
安卓:{
发件人ID:“”
},
ios:{
警告:“正确”,
徽章:“真的”,
声音:“真的”
},
wns:{}
});
//处理注册事件。
pushRegistration.on('registration',函数(数据){
//获取设备的本机平台。
如果(设备){
调试器
var platform=device.platform;
//在注册期间获取返回的句柄。
var handle=data.registrationId;
//设置特定于设备的消息模板。
如果(平台=='android'| |平台=='android'){
//注册GCM通知。
window.azureClient.push.register('gcm',handle.replace(“|“,”){
我的模板:{
正文:{
数据:{
消息:“{$(messageParam)}”
}
}
}
});
}else if(device.platform=='iOS'){
//注册通知。
window.azureClient.push.register('apns',handle.replace(“|“,”){
我的模板:{
正文:{
aps:{
警报:“{$(messageParam)}”
}
}
}
});
}else if(device.platform==='windows'){
//注册WNS通知。
window.azureClient.push.register('wns',handle.replace(“|”,”){
我的模板:{
正文:“$(messageParam)”,
标题:{
“X-WNS-Type”:“WNS/toast”
}
}
});
}
}
});
pushRegistration.on('notification',函数(数据,d2){
警报(“推送接收:”+数据消息);
});
pushRegistration.on('error',函数(err){
控制台。警告(“错误”,错误)
});
}

用于Apache Cordova的Azure Mobile Apps SDK还不能用于安装。您需要对
/push/installations/{applicationId}
端点(推送刀片服务器为您配置的端点)执行HTTP POST请求。正文必须是通知中心的有效安装对象


在我的书()中,我使用C#作为语言来讲述这个过程。这将允许您微调发送的推送参数,因为您发送的是与推送对象直接相关的配置对象。

最好告诉我们您是如何注册的?它是通过Azure应用程序服务还是直接到通知中心?您的安装对象看起来像什么?很明显,自从你添加了“NewVince”后,你已经更改了锅炉板,这不是锅炉板中的标准配置。我已经在azure移动应用程序下启用了推送刀片。我使用我在编辑中添加的代码从应用程序注册。我不知道“NewVincement”是从哪里来的-我确实在推送刀片中创建了一个标签,并选择了“自动添加”。太好了,谢谢您,我将尝试一下。我发誓我以前在其他应用程序中使用过这个东西,但有什么变化吗?还是我疯了?还有,我从哪里获得{applicationId}值?在对代码进行分析后,我发现了facebook auth和Azure应用服务推送刀片的一个bug。我正在努力给你解决问题。你能打电话联系我吗zumopm@microsoft.com我们会整理更多的信息。applicationID在SDK中的client.getApplicationInstallationId()处可用