0

How does offline storage/local storage work in maximo anywhere-work execution app. Please explain with sample. localstorage set/get methods are used but how is data storage happening in device .Does it store in some device database?

developer
  • 92
  • 7

2 Answers2

0

We use the Mobilefirst Json store which is a local SQLite database. If you look in the JavaScript for ModelService.save that's where we save to the store. And ModelService.all is where we read from the store

scott dickerson
  • 908
  • 1
  • 5
  • 13
  • Thanks scott.Do you have any sample code for reference. – developer Jan 18 '16 at 04:00
  • Well for the "save" to local json store you can see WorkLogHandler.js method named _saveTransaction(). – scott dickerson Jan 18 '16 at 16:51
  • How is locally saved data send to server after certain heartbeat interval mentioned. Do we need to configure anywhere to send to server? – developer Jan 19 '16 at 09:36
  • No, the Anywhere Data Model will automatically sync these local Json stores with the Maximo Server after every save transaction if a connection is available. And if a connection is not available (device is offline), the data model will automatically build up a transaction queue, and once a connection becomes available again, it will automatically sync these local changes with the Maximo server. The heartbeat interval is not used for syncing, only for detecting the connection status from the server. – scott dickerson Jan 20 '16 at 15:20
  • Thanks for the valuable info scott:) – developer Jan 21 '16 at 04:28
  • Is there any way to check, whether data is saved in offline db? – developer Jan 29 '16 at 05:58
  • 1
    In Chrome Simulator, the local/offline dbs show up in the Resources tab of the Developer Javascript console. On a real device, it's harder to do this without rooting the device and installing a JSONStore browser app. In general though if you receive a result from the ModelService.all methods, you can be sure that the data has been read from the local storage. – scott dickerson Jan 31 '16 at 16:36
  • Thanks scott, for offline db, i need to check Resources-Local Storage tab right? – developer Feb 01 '16 at 11:40
  • Does offline storage gets cleared off once i logout of anywhere app? – developer Apr 29 '16 at 05:50
0

It will remain there unless you clear data/cache of the app. Did you know that we still can login offline?