2016-09-15 12 views
-1

私たちはmfp8.0でionic appを開発しています。私たちは、次のコードを使用してmfpサーバーに接続します。MFP8.0でデバイスを登録できません

var Messages = { 
    // Add here your messages for the default language. 
    // Generate a similar file with a language suffix containing the translated messages. 
    // key1 : message1, 
}; 

var wlInitOptions = { 
    // Options to initialize with the WL.Client object. 
    // For initialization options please refer to IBM MobileFirst Platform Foundation Knowledge Center. 
    onSuccess:function(){alert('success')}, 
    onFailure:function(){alert('fail')} 
}; 

function wlCommonInit() { 
    app.init(); 
} 

var app = { 
    //initialize app 
    "init": function init() { 
     app.testServerConnection(); 
    }, 
    //test server connection 
    "testServerConnection": function testServerConnection() { 
    WL.App.getServerUrl(function (url) { 
    }); 

    WLAuthorizationManager.obtainAccessToken() 
     .then(
     function (accessToken) { 
      alert('accessToken '+JSON.stringify(accessToken)); 
      isPushSupported(); 
     }, 
     function (error) { 
      alert('Error '+error); 
     } 
     ); 
    }, 

} 

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(
      {"phoneNumber":""}, // workaround due to a defect in the current release of the product. An empty "phoneNumber" property must be passed at this time. 
      function(successResponse) { 
       alert("Successfully registered"); 
      }, 
      function(failureResponse) { 
       alert("Failed to register"); 
       alert("Failed to register device:" + JSON.stringify(failureResponse)); 
      } 
     ) 
    ); 
} 

私たちはmfpサーバーに接続することができます。しかし、プッシュ通知のためのデバイスを登録できませんでした。私たちは、実際には、我々は最近、このエラーを取得している、

"com.ibm.mobilefirstplatform.clientsdk.android.push.api.MFPPushException:Response:Status=404, Text:Error 404: SRVE0295E: Error reported: 404\r\n, Error Message : Not Found" 

(または)

"com.ibm.mobilefirstplatform.clientsdk.android.push.api.MFPPushException:Response:Status=500,Text:{\"errorCode\":\"UNEXPECTED_ERROR\",\"errorMsg\":\"Unexpected Error Encountered\"}, Error Message : Unexpected Error Encountered" 

を次のエラーを取得しています。その前に、同じコードが私たちのためにうまくいきました。

誰もが助けてくれます!

答えて

2

の変更に応じて登録するデバイスの機能。 リンクを介してアクセスしてください:それは長いバックから取り組んでいた https://github.com/MobileFirst-Platform-Developer-Center/PushNotificationsCordova/blob/release80/www/js/index.js

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

あなたのコードスニペットを使用すると、プッシュサービスにアプリケーションを登録しようとしなかった方法を示していない...

あなたはプッシュのチュートリアルの指示に従い、質問を開く前に、サンプルのプッシュアプ​​リケーションを見ていました?

は、ここでは、チュートリアルやサンプルを参照してください:https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/notifications/handling-push-notifications/

+0

。 suddently、それは動作しません。それは私がこの質問を提起したものです。 –

+0

更新されたSDKとサーバーインスタンスを使用していることを確認してください。最新のSDKでは、phoneNumberの回避策は必要ありません。最新のAPIについては、コードバのチュートリアルを参照してください。 –

関連する問題