Defining Offline Settings for Applications¶
Define offline settings for the selected application. Offline support enables client applications to access back-end data without a connection. When offline, applications access data from an offline store on the client. SAP Mobile Services moves data between the back end and the client offline store.
The destination settings determine how SAP Mobile Services creates the initial offline store on the client,
and how it processes requests for updates from the back end. Define offline back-end connection settings for an application
by importing a configuration (.ini
) file that has been prepared by a developer. To adjust any settings, you can use the
built-in editor to change the properties accordingly at runtime. Be sure to confer with the application developer before making any changes, since changes can impact the mobile application significantly.
See these sections in the Native OData App Development and SAP Business Technology Platform SDK documentation:
To define settings:
-
In SAP BTP cockpit, select Mobile Applications > Native/Hybrid.
-
Select an application, then select Mobile Offline Access under Assigned Features.
-
Select Configuration to see a list of configured destinations.
-
To import an offline configuration, select the icon, browse and select a configuration file.
Note
Only
.ini
files can be imported. When you import settings, the state of the offline configuration changes to Configured.For information about Application Configuration files, see:
- SAP Mobile Platform SDK apps – Defining an Application Configuration File with Defining Requests
- SAP SDK for iOS apps – Defining an Application Configuration File with Defining Queries
- SAP SDK for Android apps – Defining an Application Configuration File with Defining Queries
-
Select the Offline Policies tab to set incoming request throttling threshold and offline store upload policies for the application.
-
Under Throttling Policy, select Enable Throttling to set throttling policy. Once the policy is enabled, you can control the activity level for the application. Set thresholds for throttling activity once thresholds are reached.
For Incoming Request Throttling Threshold, configure the request throttling threshold, from 1 to 200 requests. The default value is 200 requests per second. When the offline service reaches the threshold value, no additional requests are handled.
-
Under Offline Store Upload Policy, select Enable Offline Store Upload to set offline store upload policies. Once the policy is enabled, the device user can upload the local offline store files to the server for the developer to analyze or troubleshoot, subject to the upload policy settings. Specify policy properties.
Offline Store Upload Policy Properties
Property Default Description Delete Offline Store After 7 days The time to elapse before the offline store files are deleted automatically. This security measure protects the device user, but be sure to allow enough time for the developer to perform the troubleshooting or analysis. The maximum value is 30 days. For legacy configuration values that are more than 30, the value is changed to 30 automatically. Maximum Offline Store Size 32 MB The maximum size allowed for the offline store files.
-
-
Select the Offline Stores tab to view the uploaded offline stores.
You see the list of existing offline stores that are available in offline settings. You can also view the Unique ID, Device ID, Created By, File Size, Creation Data, and the Actions you can perform for each offline store.
-
To download an existing offline store, click the icon.
-
To delete an existing offline store, select the corresponding check box, and click the icon.
-
Select Save.
Editing the Application Configuration File¶
Use the Offline editor to make updates to the application configuration file. You can view base endpoint properties for the selected offline application, and set some custom parameters in the application configuration file using SAP BTP cockpit.
An example of a custom parameter is to disable CSRF for the development and test environment, using the disable_fetch_csrf_token_request
property described in step 5. Create a key-value pair using Y to disable CSRF Token protection. This is not supported in a production system because of security reasons, but is useful in a QA, development, or test system.
Another example of a custom parameter is to enter before and after defining requests at the end-point level, using the before_function
and after_function
properties described in step 5. The offline service sends separate requests to the back-end server based on this configuration.
To learn more, see Application Configuration File (iOS) and Defining an Application Configuration File (Android).
-
In SAP BTP cockpit, select Mobile Applications > Native/Hybrid.
-
Select an application, then select Mobile Offline Access under Assigned Features (or add it first).
On the Configuration tab, any offline data store destinations are listed.
Destination Properties
Property Description Destination The offline client endpoint destination, such as com.<domain>edm.sampleservice.v2
.State The current state of the destination, such as No Custom Settings or Configured. Action The action to take such as Create, Edit or Delete. -
Select the icon.
-
Specify endpoint properties, and click Next.
Endpoint Properties
Property Description Destination Name (Display only) The destination name cannot be modified. Prepopulates Offline Data Whether to prepopulate offline data on the client. Select Yes, No or Shared-only. Data Refresh Interval How often to refresh the data on the client when online, in minutes. Service Document Format The acceptable service document format to use for the OData back-end server. You can enter a customized value as a string, such as application/name
, or you can selectapplication/atomsvc+xml
,application/xml
orapplication/json
.OData Communication Format The format used, such as application/json;q=1,application/atom+xml;q=0.5
.Delta Communication Format A subset of the OData communication format, such as application/atom+xml
.Database Collation Character set for database collation, such as UTF8BIN
.Database Case Sensitivity Whether database case matters; select to enable case sensitivity. JSON Date Time Offset The date-time offset format, such as UTC or Defined by Offset Portion. Local Data Expiration How long to keep local data before it expires, in hours. Allow Omitting Max Length Whether to limit the maximum length of an entry; select to impose no maximum length. Content ID Header Location Content identifier header, such as Mime or Operation. Number of Max Delta Resends The maximum number of resends allowed for changes, such as 5. Batch All Defining Requests Whether to batch all requests when online. Delta Tracking Whether to track changes. Specify Auto, Always, or Never. -
In Endpoint Customized Properties, click to add private parameters, and then click Next.
Create key-value pairs for the parameters.
Endpoint Customized Properties
Property Description Key The key, such as disable_fetch_csrf_token_request
.Value Its value, such as Y
.Action The action to take, such as Create or Delete. For example:
-
check_repeatable_requests
‒ enterY
to check requests. -
disable_fetch_csrf_token_request
‒ enterY
to disable token requests. -
force_medialink_absolute_url
‒ enterY
to enforce absolute URLs. -
skip_nullable_relationship_check
‒ enterY
to skip relationship checks. -
throttling_threshold_initial_download
‒ enter a value to establish the threshold for throttling initial download, such as11
. -
throttling_threshold_upload
‒ enter a value to establish the threshold for throttling upload, such as22
-
throttling_threshold_delta_download
‒ enter a value to establish the threshold for throttling delta download, such as33
. -
media_link_prefix
‒ enter a prefix to use for media links, such astest2
. -
generate_implicit_entity_id_in_response
‒ enterY
to generate an entity ID. -
disable_fetch_csrf_token_request
‒ enterY
to disable CSRF token protection. This is not supported in a production system because of security reasons, but is useful in a QA, development, or test system. -
service_document_format
‒ enter the service document format as a string, such asapplication/json
orapplication/xml
. -
before_function
andafter_function
‒ enter before and after function to defining requests at the end-point level. The offline service sends separate requests to the back-end server based on this configuration. Sample key-value pair entries:before_function=GetProductsByRating?rating=3
after_function=GetProductsByRating?rating=4
-
-
In Client Indexes, click to add the client index parameters, and then click Next.
Client Index Properties
Property Description Index The client index name. Properties The client index properties. Action The action to take, such as Delete. -
In Defining Requests, click to add the defining request parameters, and then click Next.
Request Properties
Property Description Name The defining request name. Refresh Interval (min) The interval time, in minutes, between downloads of the shared data. Delta Tracking Specify how to track OData deltas: Auto, Always, or Never. Delta tracking can improve performance on the client. Token Lifetime (min) The time, in minutes, until the OData delta token expires. While valid, only changed data is downloaded to the offline store. When the delta token expires, the entire data set is replaced. Share Data Whether data is shared among different clients or users. Action The action to take, such as Delete. -
In Defining Request Groups, click to add the defining request group parameters, and click Finish.
Request Group Properties
Property Description Request Names Select one or more defining requests. Action The action to take, such as Delete.