-
Notifications
You must be signed in to change notification settings - Fork 0
Technical Design details
In areas of low connectivity, data is required to be made offline for the officers to perform the required operations. Following are some of the operations required:
- Ability to download from server and store data offline.
- Ability to add, update and modify existing data.
- Sync/Push the modified data back to server when connectivity restores.
- Secure data at rest (stored on file system).
Solution:
There are 3 parts to the solution.
- Choosing an offline storage mechanism.
- Strategy to push data to the server, and handle error scenarios.
- Secure data at rest.
Offline Storage:
SQLite database. It is a built-in storage mechanism provided by android sdk. Sugar ORM to be used as an abstraction to help in persistence and manipulation of the stored data. Sugar ORM takes care of creation/upgrade of the database, also it has wrappers for easy querying and manipulation of the data.
Sync process:
Data is downloaded and pushed back to the server on demand. User downloads the data and syncs it back to server when connectivity is restored. While offline, user can add/modify the data. Every record maintains a changed flag, and a sync flag. On a successful backend sync, sync flag is set to indicate that. This prevents duplicate submission of data.
Security:
SQLCipher is used to encrypt the sqlite database. This prevents anyone from extracting the sqlite database file and reading into it.