cancel
Showing results for 
Search instead for 
Did you mean: 

Android app using SMP 3.0 - offline caching and delta token

jangold
Explorer
0 Kudos

Hello,

can any one help me with storing modified(updated) data into android mobile server cache (SQLite database)? I am trying to create app, which store data from request in server cache. It seems, that only inserted and deleted entries works, but not updated (using server cache and delta token).

In my mobile app I use libraries for android from SMP 3.0(Cache-3.3.1.jar).

What exactly is my problem? I will try to describe it on example:

  1. on NWGW i have created service with entitySet TESTSet (simple data model containing id as key and value, both string) and implemented delta token
  2. i can successfully get/donwload all data for TESTSet and store them into server cache, f.e. let's say that i get 2 entries for this collection [{"id":"1", "value": "new"}, {"id":"2", "value": "new"}] - i know that json is not supported in combination with delta query, but this is only for demonstration of data that i get for my collection
  3. after that i make some modification in table, where are the data for TESTSet stored: insert one row, update one row and delete one row, so the data now contain 2 rows [{"id":"2", "value": "updated"}, {"id":"3", "value": "new"}]
  4. now i am trying again to get/download all data for TESTSet into my mobile app and becouse i have implemented delta token, i am creating request for TESTSet with deltatoken, which i get in the first request
  5. everythinkg look fine, responds contained one new entry, one modified entry and reference do deleted entry, but if I use the functionality for storing data into sever cache (from responds i get the entity in string, which i parse using parser and save the result into cache using Cache#mergeEntries), the updated entry is not stored correctly, it looks like the cache skip this entry and did not merge or store it at all
  6. if i read from server cache data, which i stored/merged, i get 2 entries [{"id":"2", "value": "new"}, {"id":"3", "value": "new"}] and i really don't understand why the value for id=2 is not changed?

CODE:

String responseData = EntityUtils.toString(response.getEntity(), HTTP.UTF_8);

IODataFeed dataFeed = Parser.parseODataFeed(responseData, "TESTSet",((IODataSchema) mCache.readDocument(ICache.DocumentType.MetaDocument, IODataSchema.class.getSimpleName())));

Cache.mergeEntries(dataFeed, "TESTSet");

Can any one help me, where could be my the problem?

Best regards,

JG

Accepted Solutions (1)

Accepted Solutions (1)

jangold
Explorer
0 Kudos

I created OSS message.

This problem will be fixed in the patch of SMP 3.0 SP04 which will be released most likely at the beginning of August.

jangold
Explorer
0 Kudos

Problem solved in patch SP04 PL01 (SMPSDK30004_1-21011834.ZIP) released in 08.08.2014.

Answers (0)