0
votes

Anyone ever encounter error such as "WL should be created first"?

My android device and emulator throw error callback when they connect to MFP server or call adapter.

However, my browser simulator works perfectly when they call adapter. MFP Server version 8.0.0.00-20160803-0909 MFP CLI version 8.0.0-2016070716 Cordova version 6.3.0

This is one of the part that gives me "WL should be created first"

function wlCommonInit() {

  WL.App.getServerUrl(function (url) {
    alert(url);
  });

  MFPPush.initialize(
    function(success){
      //alert('--> push init success');
      MFPPush.registerNotificationsCallback(NotificationReceived);
    },
    function(failure){
      //alert('--> push init failure', failure);
    }
  )
  var NotificationReceived = function(message) {
    console.log('--> push notification received', message)
    //alert(message.alert);
  }

  WLAuthorizationManager.obtainAccessToken("push.mobileclient")
  .then(
    function (accessToken) {
      alert("Connected to MobileFirst Server");
      var options = {"phoneNumber": ""};
        MFPPush.registerDevice(
          options,
          function(success){
            //alert('--> push register success');
            var tag = ['permataMobile'];
            MFPPush.subscribe(
              tag,
              function(success){
                //alert('--> push subscribe success');
              },
              function(failure){
                //alert('--> push subscribe failure', failure);
              }
            )
          },
          function(failure){
            //alert('--> push register failure  '+ JSON.stringify(failure));
          }
        )
    },
    function (error) {
      //alert("Failed to connect to MobileFirst Server");
    }
  );
}
1
Did you do the scope mapping in the console? - Idan Adar
push.mobileclient this yes.. but even i can not get result from here WL.App.getServerUrl(function (url) { alert(url); }); - rizkiana novitasari
I got this problem fixed by two ways.. 1. My first app can not connect to mfp server saying WL should be created first. What i did was delete my instance on server and re register the app. It works on my emulater 2. My second app can not connect to mfp server and can not call adapter What i did was create app from scratch, re add plugin, and re register. It works on my emulator - rizkiana novitasari
Please write the above as an answer to the question. - Idan Adar

1 Answers

2
votes

I had a similar problem and fixed it by the following work around:

  1. My first app could not connect to the MFP server with an error that WL should be created first. Workaround: Delete app instance on the server and re-register the app. It works on the emulator after that.
  2. My second app could not connect to the MFP server or invoke the adapter. Workaround: Create the app from scratch, re add the plugin, and re-register the app. It works on the emulator after that.