I just tried a small sample worklight app on my phone to test the JSONStore, the init code for which is as follows in my file jsontest.js
.
function wlCommonInit(){
var i;
var collectionName = 'exp';
var options = {};
var collections = {};
//Object that defines the 'people' collection
collections[collectionName] = {};
//Object that defines the Search Fields for the 'people' collection
WL.JSONStore.destroy(options);
collections[collectionName].searchFields = {name: 'string', age: 'integer'};
WL.JSONStore.init(collections, options)
.then(function () {
alert ("JSON Store initialization success!");
})
.fail(function (errorObject) {
alert (errorObject);
});
I'm getting the error -1: PERSISTENT STORE FAILURE when I run the app on my phone (Galaxy Nexus). The following errorObject
is returned.
{
"src": "initCollection",
"err": -1,
"msg": "PERSISTENT_STORE_FAILURE",
"col": "exp"
"usr": "jsonstore",
"doc": {},
"res": {}
}
The app works fine in the Worklight console simulator and in the AVD. My phone has enough storage (600 MB left) to run the app so that shouldn't be a problem.
What am I doing wrong here? Does this have anything to do with the fact that I'm running a custom ROM?
UPDATE: I checked the app on my dad's phone (Sony Xperia Sola) and it worked! Very weird. It doesn't run on my phone, even though all other third-party apps that I have downloaded so far on my phone from the Play Store and other sources all work fine.
So, does Worklight not support custom ROMs?
The custom ROM that I am using is VanirAOSP. I applied a popular custom kernel and I'm using the Dalvik runtime (not ART or anything like that).
I also think that the problem might be because Worklight apps are not fully supported on Android 4.4 KitKat.
Would appreciate it if someone would shed some light on this.