I am trying to initialize a JSONStore collection when my mobile device does not have a network connection. I have set the option, however, the init never completes.
{localKeyGen: true}
The same code runs fine if the device has a network connection.
Is there something else that I need to code in order to work with a local token while offline?
Did you take a look at the JSONStore sample application? (to compare your code)
The sample application is set to connectOnStartup: false
, so whether your device is online or not, it does not matter. It is also not important to deploy the adapter for this specific issue.
In the project > apps > JSONStoreAPI > common > js > main.js
I have added localKeyGen: true
to the options
variable:
var options = {
localKeyGen: true
};
This variable is passed while using WL.JSONStore.init(collections, options)
.
I then built and deployed the project and continued to preview it in Worklight Console as well as test on an Android device (while in airplane mode).
I have entered a username and password (required if localKeyGen
is to be used), and clicked on the login/initialize button, which passed successfully and the collection was initialized.