Data Storage in Flow Activities

There are generally two ways to store data on the device. The first option is a simple key value store exposed as Scandit.LocalStorage, the other option is to use Cloud DB, which is automatically synced to the server and all connected devices.

LocalStorage

The local key-value storage can be accessed and manipulated through the Flow mobile API. It is shared between all activities on the device and is cleared when the device is disconnected from a Flow account.

Cloud DB

To get started with the cloud database you need to create a class definition in the Storage tab on the web dashboard. Once you create a class definition you can start using it in your activities to create and query objects.

Changes to the database schema are applied while the app is running. For schema changes to become visible to a JavaScript activity, an activity restart is required because the definitions in JavaScript are retrieved on activity start only. This functionality depends on push notifications. If the user has disabled these for the Flow app, a restart of the activity will not be sufficient and the entire Flow app will need to be restarted.

The JavaScript documentation for the database is provided in Scandit.Db. It allows storing attachments, such as photos taken by the user. It also provides a way to listen for sync events, for example to show a loading indicator to the user while the database is syncing.

To learn more about how to use the database in your activity, take a look at the API documentation.

Replication in the mobile app is configured to be continuous, which means that, after the initial replication is done, the replication continues for new items in the background.