Start HTML5 App Offline
In my Session MOB 205 the question came up “if the new OData Offline Service would allow an app to start in an offline mode?”.
The short answer is: Yes
And in the lines below you can see how it can be done. I did one small change to my demo code I used the session MOB 205 in order to achieve this.
In the original demo the callback from the logon manager initialization “logonSuccessCallback” made an Odata call to fill the table.
// **** initialize the logon manager with App ID and re configured Logon context
function init() {
sap.Logon.init(logonSuccessCallback, logonErrorCallback, appId, context);
}
// **** Callback from the Logon Manager upon successfull registration***
function logonSuccessCallback(result) {
applicationContext = result;
showScreen(“MainDiv”);
// this.read();
}
If this Odata call (this.read() ) gets commented out everything works. The reason is that, now the app can open the offline store before the first OData call.
So once the App is started the user can click on “Open Offline store” which will open the existing store and than the user can click on “Odata Queary” which will fill the table. This read, after the offline store has been opened, will go against the local Data in the Database.
The pre condition for this is that the Offline store was once filled.
Find the original index.html attached if you want to try this for yourself. For Details on how to get this up and running please go to Daniels Blog “Getting Started with Kapsel” to get all the details.
Sami