Developer

Offline OData Refreshes and Updates

Offline OData applications use a local, offline store (on-device copy of the enterprise data) to ensure that data is always accessible, even when the mobile device is offline.

  • Updating the offline store
    Applications can make changes to data when the mobile device is offline. Those changes are made to the local offline store, then stored in a request queue. Updates that are queued but have not yet been sent to the back end are reflected in the local offline store. The application developer must ensure that the offline store is periodically updated from the back end when the mobile device is online. This periodic update is called a refresh. The timing of the refresh is at the discretion of the application developer. For example, all of these can be considered depending on the application:
    • Give the user control over the timing of the refresh
    • Refresh at the beginning and end of the day
    • Refresh when the application opens
    • Refresh every 15 minutes
    • Refresh after every flush, and so on
  • Updating the back-end

    When the mobile device is online, a request queue flush can be performed. Flushing the request queue sends up changes that have been made to the offline store but have not yet been made to the back end. Once a request is successfully received by the back end, the request is deleted from the queue, the change is made to the back end, and a new version of that object is sent to the offline store the next time the application performs a refresh.

  • Schema upgrades

    A schema upgrade of the offline store is performed whenever a new version of the OData service is provided or a schema change is detected.

    Schema upgrades are expected to be additive, meaning you can alter the OData model by adding entities or properties, but not by removing entities or properties. Because of this, the operations in the request queue can be replayed successfully on the new schema. If a non-additive change to the schema is required, then a new OData end point should be used for the backend data, new defining requests should be used in the application, and a new application would need to be deployed.

  • Background updates

    Background updates are possible, but require the application developer to ensure that flush and refresh operations are called in a manner that enables them to continue in the background.

    You can find additional details about background synchronization on the SAP Community Network (SCN) Mobile Application Development Platform for Developers - Native AppsInformation published on SAP site (including blog posts and How-To guides), and the OData API documentation that is bundled with the SAP Mobile Platform SDK.