. . .

Offline Handling

Users aren't always online; offline handling ensures all your apps work even when the user's connectivity is subpar or nonexistent.

ApiOmat SDKs have built-in offline handling so you can easily manage data when the user device is offline. Enable users to use the app offline, read and collect cached data on the device and update everything once they're back online. Decide which offline strategy is best for you and implement it for all, some or none of the data models.

Relevant Links: Delta Sync | Offline Handling in SDKs

Key Capabilities

Class-Based Offline Handling

Implement offline handling for individual data models, making all requests related to that class stored persistently.

Request-based Offline Handling

Implement offline handling for a specific request. You can also have offline handling enabled for a class, and disable it for a single request.

Network First Strategy

Only use the cache if the app can’t communicate with the server or returns 304 (local and remote data are the same).

Cache then Network Strategy

Reads from cache first, then sends a request to the server, leading to a second callback.

Cache else Network Strategy

Use the cache, if nothing is there, send a request.

Network Only

No data caching, on save as well as read.

How it works

Offline handling is the management of the data when the device of the user is offline. Requests to the ApiOmat server fail and storing/recieving capapabilities are blocked when the device is offline without offline handling. With offline handling, both problems are solved:

  1. Outgoing save and delete requests are queued to be sent later (as soon as the device goes back online)

  2. Responses to requests that fetch data get saved while the device is still online, so you get the data from a saved response when doing an offline request.

The programmer can select different strategies, in which order the SDK should try to exchange data online or offline.

The data gets saved either in persistent storage (mostly SQLite) or in an in-memory storage. While queries in online mode are sent to ApiOmat, offline queries will go into the SQLite database and return results without the need to connect to any server.

images/download/attachments/61478508/Doku_Online_Offline.gif