Develop an offline Hybrid OData application.
Setting Up a Hybrid OData Offline Application
This task flow does not include all configurable options, but guides the developer
and server administrator through the commonly performed tasks required to configure
an offline application.
Note A supported version of an OData (for example V2) Web service must be available and
accessible by SAP Mobile Platform Server or
SAP HANA Cloud Platform mobile services . For example Netweaver Gateway,
Integration Gateway, or a third-party service such as
Apache Olingo
.
- Determine the data requirements of your offline application:
- Identify the data to be made available offline -
identify the portions of your application that are to operate offline,
and the OData entity collections to be referenced.
- Compile the list of entity collections into an initial
defining request.
- Reduce the overall data transmitted to the client -
your application often requires only a small subset of the data
available in each entity collection. Review each referenced entity
collection. Determine if it is possible to reduce the amount of data by
using OData $select, $filter, or
other queries. If so, add those OData URI primitives to the collection
referenced in the defining request.
- Identify sharable data collections - for security
or performance reasons, an OData Web service may intrinsically filter
the results that are visible to the user who is logged in. In other
cases, the result set may be exactly the same for all users of the
application. Such collections can be marked as shared on
SAP Mobile Platform Server or
SAP HANA Cloud Platform mobile services, which optimizes back-end
requests. Review your entity collections and identify any collections
that meet this "shared" definition, and mark them as such in the
defining request.
- Create the offline application configuration initialization (.ini) file for the
offline application, which has two main sections:
- Endpoint – identifies and determines how OData producer endpoints from
which the offline app retrieves and stores offline data should be
processed by SAP Mobile Platform Server or
SAP HANA Cloud Platform mobile services: how the offline database is
prepopulated before it is downloaded to the client, indexing, and so on.
See Application
Configuration File
- Defining requests - defines various characteristics of how the retrieved
data for a given endpoint is managed by SAP Mobile Platform Server
or SAP HANA Cloud Platform mobile services: whether or not the data is
shared, refresh interval, delta tracking, and so on. See Defining Requests
Remember Use an application configuration file only if you
require non-default behavior.
- Add the Offline OData Plugin to your Hybrid App. See Offline OData Plugin
- Configure SAP Mobile Platform Server or
SAP HANA Cloud Platform mobile services for offline applications:
- Create the application on the server. See:
- Configure the endpoints. See:
- Configure offline specific settings. See:
- Import offline application settings from the application configuration
file. See:
Working With an Offline Store
You can find additional details for performing these tasks on the SAP Community
Network (SCN)
Mobile Application
Development Platform for Developers - Hybrid Apps
(including blog posts
and How-To guides), and the OData API documentation that is bundled with the
SAP Mobile Platform SDK:
- Create and open an offline store. An application can create and manage
multiple store objects if required.
- Populate the offline store by performing an initial sync (which is built
into the open operation). The application must have
network connectivity. During initialization, the client communicates with
SAP Mobile Platform Server or
SAP HANA Cloud Platform mobile services, which collects data from an
OData endpoint based on the defining request, creates a database that stores
the data, and pushes that database down to the offline store on the device.
- Using the same OData APIs that manipulate an online store, perform any
necessary operations (create, read, update, and so on) on the data in the
offline store.
- Send pending modification requests to the server/back-end (flush operation).
The application must have network connectivity. The server
(SAP Mobile Platform Server or
SAP HANA Cloud Platform mobile services) and the back-end determine how
conflict and error resolution are handled. See Designing an Offline
Application to Handle Conflicts and Errors for more information.
- Refresh the offline store. The application must have network connectivity.
See Offline OData
Refreshes and Updates for more information.
- Remove data from and delete the offline store.