The SAP Cloud Platform SDK for Android provides an Open Data Protocol (OData) component for developing offline and online mobile applications that use SAP Cloud Platform Mobile Services.
This component provides a high-level API (referred to as Dynamic API) and generated proxy classes for data query and manipulation which are mapped to OData. This allows developers to leverage OData capabilities while hiding the details of interaction with an OData service to parse OData payloads, produce OData requests, and handle ODataresponses.
An offline application defines OData queries to retrieve data from back-end OData service when online to create an offline store. Once created, the offline store serves as a (local) the OData service regardless if network connectivity is available and synchronizes with back-end OData services via upload/download when network connectivity is available.
If your application requires up-to-date back-end data and operates in areas with reliable connectivity, you may not need to create an offline store and may opt to operate in online mode only. In online mode, if you cache data locally for optimization purpose, you are responsible for handling data concurrency.
In online mode the library supports OData Version 2.0 and 4.0. Offline mode is restricted to OData Version 2.0.
See Offline API for more information.
This section covers architecture, important concepts, and usage examples for the OData component. It is intended to help developers quickly gain an understanding of the query and manipulation API. Developers should be familiar with Open Data Protocol.
About the Code Samples¶
The code samples in this document use a simple Event Management OData service with the following entity types: User, Event, Session, UserSessionAgenda, Feature, GlobalTheme and Track. Each event may have a theme, is associated with a set of features and contains a set of sessions as well as tracks. Each session has an associated track. A user session agenda indicates a registration of a user to attend a particular session.
A relationship involves two entity types, but there can be more than one relationship between the two entity types. In the Event Management OData service, there is a one-to-many relationship Event_Session_One_Many0 between Event and Session, enabling to navigate from one event to associated sessions. This implies that we may also navigate from a session to its associated event, but that is not always the case. There is also a many-to-zero-to-one relationship Session_Event_Many_ZeroToOne1 between Session and Event, enabling to navigate from a session to an event. Event_Session_One_Many0 and Session_Event_Many_ZeroToOne1 are two different relationships. Neither one implies or can replace the other.
The corresponding entity sets are Users, Events, Sessions, UserSessionAgendas, Features, GlobalThemes and Tracks.
See Sample Service OData Metadata for complete details.