cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Hi,

I'm trying to enable offline OData in an Android Application. I created the application via the creation wizard in Android Studio and everything worked fine with the online OData. Then I followed this guide:

https://developers.sap.com/hk/tutorials/cp-sdk-android-wizard-app-offline.html#db432312-0f49-4553-b3...

but I encounter this problem: on the first launch the offline data store in created according to the backend data, nevertheless If I try to edit a record and then closing the app, when i open it again the edited record is still there even if there was no change on the backend data, like the app is not actually refreshing the offline store but just showing a saved copy of it.

Can anyone help?

0 Likes
View Entire Topic
Dan_vL
Product and Topic Expert
Product and Topic Expert
0 Likes

The tutorial mentioned above does not include the steps necessary to perform an upload of the locally modified changes.

Here are a few more resources that do cover this topic.

https://blogs.sap.com/2018/10/15/step-by-step-with-the-sap-cloud-platform-sdk-for-android-part-6-off...

and

https://github.com/SAP/cloud-sdk-android-offline-odata

Hope that helps,

Dan van Leeuwen

Former Member
0 Likes

Thank you! This was really helpful!

I have another question tough: I am trying to perform an update operation offline in the first place and then to sync my on premise system. When i call the Update... method on my online data provider i catch the http call on my ECC system through a breakpoint. Otherwise when i call the Update operation on my offline data provider and the run the sync operation nothing happens. Am I using this feature in a wrong way?

Thank you

BWomelsdorf
Product and Topic Expert
Product and Topic Expert
0 Likes

Angelo - I wouldn't expect to see any network traffic when you do the local update. That's why we call the feature "offline" OData. But if the local update was successful you should see network traffic when you do the sync, as long as the offlinedataprovider.upload() method is being called. Did you put the code to update data to the backend as Daniel suggested? You can find this in https://blogs.sap.com/2018/12/08/step-by-step-with-the-sap-cloud-platform-sdk-for-android-part-6a-sy....

Former Member
0 Likes

Hi Britt,

That's the point. I created a Function Importo on my ECC systen via the SEGW transaction. Then i generated the proxy classes and the method highlighted in screenshot 1 was generated.

This is the declaration of my online and offline service container and data provider

Online:

myDataProvider = new OnlineODataProvider("ZTESTANGELOSRVEntities", serviceURL + "/" + connectionID , myOkHttpClient);
myServiceContainer = new ZTESTANGELOSRVEntities(myDataProvider);

Offline:

myOfflineDataProvider = new OfflineODataProvider(url, offParam, myOkHttpClient, null, delegate);

myOfflineServiceContainer = new ZTESTANGELOSRVEntities(myOfflineDataProvider);

When i call the updateLifnr method on my online service container everything is fine. On the other hand when i do the same on the offline service container and then perform a sync nothing happens and i get the following error.

com.sap.cloud.mobile.odata.offline: [AsyncTask #4] [-10028] Error at URL position 1: "UpdateLifnr" is not an entity set in entity container "Z_TEST_ANGELO_SRV_Entities"

What am i doing wrong?

Thank you in advance