Skip to Content

Technical Cache for Online Apps – SMP 3.0 OData SDK SP06 (Android)

The SMP 3.0 OData SDK SP06 for Android introduced the concept of technical cache in the online store (OnlineODataStore). The technical cache stores the response of a GET request in the device. It is read-only, in consequence CREATE, UPDATE and DELETE requests would fail if the device is out of coverage.

The Technical cache is disabled by default. It is up to the application developer to use this feature, for example, to improve user experience.

Four (4) steps are required to use the technical cache:

1. Initialize Online Store with OnlineStoreOptions

The OnlineStoreOptions contains configuration information for the online store. In order to enable the Technical cache you need to set the useCache property to true and assign a cache encryption key (cacheEncryptionKey) to encrypt/decrypt cache persistent store.

The memory size of the device limits the technical cache size but it has a mechanism to remove older items in case the data exceeds the cache size. In the OnlineStoreOptions the following optional attributes can be used to configure the maximum cache size in kBytes (maximumCacheSize – default: 16384 kBytes) and percentage of remaining items size in the cache when the older items are removed (cacheCleanupTreshold – default: 60%). A cacheCleanupTreshold of 60% means that 40% of the cache data will be removed.

Code Snippets – How to enable technical cache

//Options to enable Technical Cache

OnlineStoreOptions onlineOptions = new OnlineStoreOptions();

onlineOptions.useCache = true;

onlineOptions.cacheEncryptionKey = “secret”;


//Method to open a new online store asynchronously, endpointURL, httpConversationManager, openListener, onlineOptions);

2.  Send a GET request asynchronously

The client app must send the GET requests through the asynchronous read methods because the content of the technical cache will be return in the ODataRequestListener. For example, application developers can use any of the following read methods:

  • scheduleReadEntity(ODataEntity entity, ODataRequestListener listener, Map<String,String> options)

        Scheduling method for reading an Entity

  • scheduleReadEntity(String resourcePath, ODataRequestListener listener, Map<String,String>  options)

        Scheduling method for reading an Entity

  • scheduleReadEntitySet(String resourcePath, ODataRequestListener listener, Map<String,String>  options)

        Scheduling method for reading an Entity set

3. Implement the callback method requestCacheResponse in the ODataRequestListener

In each request the online store notifies the application about the cached response within the request listener through the requestCacheResponse callback

The callback sequence for requests is represented in the following diagram:


Code Snippets – How to get data from technical cache


public void requestCacheResponse(ODataRequestExecution request) {

ODataProperty property;

ODataPropMap properties;

//Verify request’s response is not null. Request is always not null

if (request.getResponse() != null) {

       //Parse the response

       ODataResponseSingle response = (ODataResponseSingle) request.getResponse();

       if (response!=null){

              //Get the response payload

              ODataEntitySet feed = (ODataEntitySet) response.getPayload();

              if (feed!=null){

                //Get the list of ODataEntity

                List<ODataEntity> entities = feed.getEntities();

                           //Loop to retrieve the information from the response

                           for (ODataEntity entity: entities){

                            //Obtain the properties you want to display in the screen

                      properties = entity.getProperties();

                      property = properties.get(<property-name>);


                //TODO – Send content to the screen





and last but not least,

4. include the following libraries and resources

The following libraries should be imported under libs folder

    • AfariaSLL.jar
    • ClientHubSLL
    • ClientLog.jar
    • Common.jar
    • Connectivity.jar
    • CoreServices.jar
    • DataVaultLib.jar
    • guava.jar
    • HttpConvAuthFlows.jar
    • HttpConversation.jar
    • maflogger.jar
    • maflogoncore.jar
    • maflogonui.jar
    • mafuicomponents.jar
    • mafsettingscreen.jar
    • MobilePlace.jar
    • ODataAPI.jar
    • odataoffline.jar
    • ODataOnline.jar
    • perflib.jar
    • Request.jar
    • sap-e2etrace.jar
    • simple-xml.jar
    • SupportabilityFacade.jar
    • XscriptParser.jar

2. The following resources should be imported under libs/armeabi folder


You can find the .jar and .so files in your OData SDK installation folder:

  • <Client SDK dir>\NativeSDK\ODataFramework\Android\libraries
  • <Client SDK dir>\NativeSDK\MAFReuse\Android\libraries
  • <Client SDK dir>\NativeSDK\ODataFramework\Android\libraries\armeabi

Hope this helps


You must be Logged on to comment or reply to a post.
  • Is there a way to open the Online store without internet? I want to access the data in my technical cache, but the store opening fails if there’s no internet.

    • Hi Ali, the first time the app opens the store, the device needs to be on the network. The technical cache applies only to asynchronous GET request.

  • Hello Claudia.

    Could you please explain the role of Technical Cache? Is it only database for downloaded records and we can’t update records without networks and post it when network will be available? Can we exit from application and save updated data?

    Do you have any example on github?

    Thanks in advance for answer.

    • Hi Alexey,

      The Mobile SDK has two types of stores: online store and offline store.

      • Online OData Store API: can be used to develop applications that require up to date back-end data and have reliable connectivity.
      • Offline OData Store API: can be used to develop applications that require infrequent updates of back-end data and the connectivity may become unreliable

      Technical cache can be used to improve user experience for online applications. You can display data to the user, even if the device is out of coverage. It stores read-only data, therefore you cannot perform CUD operations on it.

      If you want to access data in offline mode and update the content, you should use the offline store. More information in this blog Getting Started with the Offline Store for Android

      Best regards,


      • Thank you for the explanation. Could you inform me, please? SMP 3.0 had the “Cache” technology in the beginning (SP01, SP02?). It was off-line technology with local database on device. Does SAP support this technology? We wrote the application on it. Do you recommend to rewrite it on offline store?

        • SMP is backward compatible, so your application should work with the latest versions. However the old classes are deprecated, which means that no further enhancement will be provided.

          • Hello, Claudia.

            We upgrade our application on SMP 3.0 SP09 SDK, but the same application crashes in connection process. We make incident #755535, but unfortunately nobody answer. Could you help in this matter? We use standard code. I write it below. SMPClientConnection* clientConn = [SMPClientConnection initializeWithAppID:@”MobileApplication.1234567″ domain:@”default” secConfiguration:@””]; [clientConn setConnectionProfileWithHost:@”” port:@”8080″ farm:nil relayServerUrlTemplate:nil enableHTTP:YES]; [clientConn setApplicationConnectionID:@””]; [SMPUserManager setDelegate:self]; SMPUserManager* userManager = [SMPUserManager initializeWithConnection:clientConn]; NSError *error = nil; NSLog(@”startServerConnection: register new user”); [userManager registerUser:@”user” password:@”password” error:&error isSyncFlag:NO];

          • Hi Alexey,

            Have you received any response in your incident? I think the incident is the best way to get an official answer for your problem.

            Best regards,