MFP8.0中的注册设备问题

时间:2016-10-27 06:39:22

标签: ionic-framework ibm-mobilefirst mobilefirst-server

我们正在开发离子应用程序与mfp8.0 。我们尝试使用以下代码注册我们的设备以进行推送通知

 function isPushSupported() {
    MFPPush.isPushSupported(
        function(successResponse) {
            alert("Push Supported: " + successResponse);
            registerDevice();
        }, function(failureResponse) {
            alert("Failed to get push support status");
        }
    );
  }

 function registerDevice() {
      WLAuthorizationManager.obtainAccessToken("push.mobileclient").then(
          MFPPush.registerDevice(
              null,
              function(successResponse) {
                  alert("Successfully registered");
              },
              function(failureResponse) {
                  alert("Failed to register device:" + JSON.stringify(failureResponse));
              }
          )
      );
   }

现在无法注册设备。 当进入registerDevice()函数时,App正在停止。

实际上,我们最近收到了这个错误。在此之前,相同的代码对我们来说运作良好。

我已经提到了文档。但是,我没有得到解决方案。我已经提到过,

  

https://github.com/MobileFirst-Platform-Developer-Center/PushNotificationsCordova/blob/release80/www/js/index.js

     

https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/notifications/handling-push-notifications/

注意:   GCM现在建议使用FCM,请参考以下链接,

  

https://developers.google.com/cloud-messaging/

实际上,在使用 FCM凭证注册我的设备后,我才面临这个问题。

任何帮助都会得到赞赏!!!

1 个答案:

答案 0 :(得分:0)

请确保您遵循正确的说明。说明在以下页面中列出:https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/notifications/sending-notifications/

  1. 访问Firebase控制台。
  2. 创建一个新项目并提供项目名称。
  3. 点击设置"齿轮"图标并选择项目设置。
  4. 单击“云消息传递”选项卡以生成服务器API密钥和发件人ID。然后单击“保存”。
相关问题