Search code examples
javascriptibm-mobilefirstjsonstore

WL.JsonStore is not initialized, When trying to build the cordova IBM Mobile First Application in Android devices and In Android Emulator


I Followed the Following Link

https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/application-development/jsonstore/cordova/#adding-jsonstore

I have Also added the JsonStore Plugin

Wl.jsonStore is not Initialized when trying to initialize the Cordova Mobile First application

 WL.JSONStore.init(collections).then(function (collections) {                
    alert("collections creted sucessfully");
     console.log("Collections created sucessfully");
    // handle success - collection.people (people's collection)
                                            }).fail(function 
    (error) {
alert(error);
     console.log(error);// handle failure                                       });

WL.Store is need to Initialized. Kinldy Help me out To fix this Issue.

enter image description here


Solution

  • At Last, I Found my answer in the IBM TroubleShoot Site

    Kindly Refer the Link:

    https://mobilefirstplatform.ibmcloud.com/tutorials/ru/foundation/8.0/troubleshooting/jsonstore/

    In config.xml, change the clientCustomInit property to true. In index.js file: add the following line at the beginning of the file:

    document.addEventListener('mfpjsonjsloaded', initWL, false);
    

    leave the WL.JSONStore.init call in wlCommonInit()

    add the following function:

    function initWL(){                                                     
      var options = typeof wlInitOptions !== 'undefined' ? wlInitOptions
      : {};                                                                
      WL.Client.init(options);                                           
    }