0

I took the sample Cordova project and added platform for Android environment then I created FCM project through Google console and then I got the sender id and server key. I added the MobileFirst server console credentials. Once I did the above steps I added the scope variable in the MobileFirst console "push.mobileclient". Finally I try to run my project using Android studio on an Android emulator.

The testing of the push notification failed while I clicked register device. Below are the error logs:

Failed to register 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"

Kindly help me to resolve the issue.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
karthik
  • 21
  • 5
  • You haven't provide the exact build level you are on. Please do.Also, does uninstalling and re-installing help resolve the issue? – Vivin K Mar 06 '17 at 09:10
  • build level means ? and i uninstall and re install apps in my native emulator. i didn't try to install device. – karthik Mar 06 '17 at 09:27
  • Which ifix version of MFP are you on? Uninstall the application from the device and reinstall it again and check if it works fine. – S.A.Norton Stanley Mar 06 '17 at 11:39
  • i did not install ifix as of now. i just started MFP and setup local environment. Ok i will try my device then let you know. – karthik Mar 06 '17 at 11:59

1 Answers1

1

Add these plugin in cordova project

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

Try to create fresh project in Firebase Console and add Server key & Sender ID in Mobilefirst console carefully.

Run in real device. Also use same network(wifi) in both Mobile and computer.

You can try without scope variable "push.mobileclient" in the MobileFirst console and try sample code:

sample code

    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));
        };
}

Check here: Not able to send push notification to iOS devices through MFP Server V8 Console

Gaurab Kumar
  • 2,144
  • 2
  • 17
  • 29
  • **hi, i just now tried in real device which is you mentioned above that senario not working. i removed push.mobileclient as wel. still i got device register failed.** – karthik Mar 07 '17 at 12:19
  • check updated answer, and lets update if you getting any error. – Gaurab Kumar Mar 07 '17 at 13:04
  • now device register problem resolved. but i could not receive push notification form operation console. i got error for ** Caused by: java.lang.IllegalArgumentException: MSAN018E: The supplied value was invalid: fe80:0:0:0:ba5a:d284:a17:7de3%utun0 for serverIpAddress.** bcos i tested in android emulator – karthik Mar 08 '17 at 05:04
  • Why you are not testing in **real device **? Check Answer again and Also check Sender id and server key carefully. In Emulator you need latest google play service. – Gaurab Kumar Mar 08 '17 at 05:12
  • yes now its working in real device. at the moment we don't have device.thanks lot your support. – karthik Mar 09 '17 at 05:53
  • hi how to send push notification using REST API in mfp 8.0 cordova apps? – karthik Aug 03 '17 at 06:24
  • sample cordova apps working fine but i could not able to see the login page i mean user based notification i have to send – karthik Aug 03 '17 at 06:25