2017-03-06 157 views
0

我拿了樣本科爾多瓦項目,並增加了Android平臺的環境,然後我通過谷歌控制檯創建了FCM項目,然後我得到了發件人ID和服務器密鑰。我添加了MobileFirst服務器控制檯憑據。一旦我做了上述步驟,我在MobileFirst控制檯「push.mobileclient」中添加了範圍變量。最後,我嘗試在Android模擬器上使用Android工作室運行我的項目。Mobilefirst 8.0科爾多瓦推送通知設備註冊失敗

當我點擊註冊設備時,推送通知的測試失敗。下面是錯誤日誌:

無法註冊device:"com.ibm.mobilefirstplatform.clientsdk.android.push.api.MFPPushException: Response: Status=400, Text: {\"errorCode\":\"invalid_client\",\"errorMsg\":\"Incorrect JWT format\"}, Error Message: Incorrect JWT format"

請幫我解決這個問題。

+0

您尚未提供確切的構建級別。請做。另外,卸載和重新安裝幫助可以解決問題嗎? –

+0

建立等級意味着什麼?我卸載並重新安裝應用程序在我的本地模擬器。我沒有嘗試安裝設備。 – karthik

+0

您的MFP的哪個ifix版本?從設備上卸載應用程序並重新安裝,並檢查它是否正常工作。 –

回答

1

科爾多瓦項目中添加這些插件

cordova plugin add cordova-plugin-mfp 
cordova plugin add cordova-plugin-mfp-push 

嘗試Firebase Console創建新的項目,並在Mobilefirst控制檯小心加入服務器密鑰 & 發件人ID

在真實設備上運行。在移動設備和電腦上也使用相同的網絡(wifi)。

您可以在不作用域變量嘗試 「push.mobileclient」 在MobileFirst控制檯,並嘗試示例代碼:

示例代碼

function wlCommonInit(){ 

    //initialize app for push notification 
     MFPPush.initialize (
      function(successResponse) { 
       alert("Push Notification Successfully intialized"); 
       MFPPush.registerNotificationsCallback(notificationReceived); 
      }, 
      function(failureResponse) { 
       alert("Failed to initialize"); 
      } 
     ); 

     //Check device is Supported for push notification 
     MFPPush.isPushSupported (
      function(successResponse) { 
       alert("Device is Push Supported"); 
      }, 
      function(failureResponse) { 
       alert("Failed to get push support status"); 
      } 
     ); 

     //register app for push notification 
     MFPPush.registerDevice(null, 
      function(successResponse) { 
        alert("Device Successfully registered"); 
      }, 
      function(failureResponse) { 
       alert("Failed to register"); 
      } 
     ); 

     var notificationReceived = function(message) { 
      alert(JSON.stringify(message)); 
     }; 
} 

入住這裏Not able to send push notification to iOS devices through MFP Server V8 Console

+0

**嗨,我剛纔在真正的設備上嘗試過,這是你上面提到的那個塞納里奧不工作。我刪除了push.mobileclient。我仍然有設備註冊失敗。** – karthik

+0

檢查更新的答案,並讓我們更新,如果你得到任何錯誤。 –

+0

現在設備註冊問題已解決。但我無法收到推送通知窗體的操作控制檯。我得到錯誤的**由於:java.lang.IllegalArgumentException:MSAN018E:提供的值是無效的:fe80:0:0:0:ba5a:d284:a17:7de3%utun0對於serverIpAddress。模擬器 – karthik