0

我正在尝试使用 Cordova 插件将 Bluemix 推送通知服务集成到 Cordova 应用程序中。按照这个http://mbaas-gettingstarted.ng.bluemix.net/hybrid#push-operations。但是,当我按如下方式注册设备时,我遇到了以下错误,

var push = IBMPush.getService();
var alertNotification = function(message) {

    IBMBluemix.getLogger().info("Received notification");
    console.log(JSON.stringify(message));
}
//Register the device
push.registerDevice("MyDeviceName", "UserName", "alertNotification").done(function(response) {
    console.log("device registration done successfully with response : ", response);
}, function(err) {
    console.log("ERROR in device registration : ", err);
});

设备注册错误:状态代码:403,状态行:禁止

  1. 我能够成功地初始化 IBMPush 服务。这确认我使用了正确的应用程序 ID 和应用程序密码。
  2. 我还交叉检查了我在 Bluemix 推送服务中使用了正确的发件人 ID(来自 Google 控制台的项目编号)和 API 密钥(API 凭据下的服务器密钥),并确保已启用 Google Cloud Messaging for Android API。

任何帮助表示赞赏!

4

1 回答 1

0

我们新的 Bluemix 移动服务混合 SDK 已发布,可与最新版本的 Cordova 一起使用。在此之后,旧的“mbaas”Cordova SDK 已被弃用,取而代之的是新的和改进的版本。

您可以在我们的 Github 上找到新的开源 Cordova 插件,网址为https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-cordova-plugin-corehttps://github.com/ibm-bluemix -mobile-services/bms-clientsdk-cordova-plugin-push

为了使用推送,我建议查看我们的HelloPush Cordova 示例并运行那里找到的 README,请注意,您需要使用新服务创建一个新后端才能正确使用新 SDK。

于 2016-03-10T17:31:27.263 回答