Mobile Offline Sync

212 Views Asked by At

I'm currently working on a React Native application, the server is already implemented and my app should implement offline sync, I'm planning to integrate realm on the mobile device to deal with the offline data and pushing the data to the implemented server when the device is online. How would I go about doing that?

1

There are 1 best solutions below

0
On

I'm trying also to make some kind of offline sync. A calendar app that works offline.

I'm developing it on ionic 4 using sqlite.

Basically, what I did is: I keep a variable with my last update timestamp.

Part 1

Get activities.

A service is running on the background, getting from the backend activities that their creation timestamp is later than the mobile last update timestamp.

Part 2

Every time the user create an activity I add the timestamp to the activities table and a flag called synced that is true / false.

Another service scans the table for synced === 'false' and does the POST request.

Hope I helped.