Migrating from Realm Database to Realm Cloud and vice versa

Hello Realm Team,

I am in the final stage before releasing my Android app. Currently I’m using a local Realm Database, however I would like to offer my users the option of syncing their app data to Realm Cloud. This would be a premium feature by subscription, so I need to be able to switch from local Realm to Realm Cloud and vice versa. What would be the best approach for this?

I haven’t been able to find any documentation, on how to migrate from local to Cloud and back in Java, so if anyone can point me to an example or provide some code, that would be highly appreciated!


Hey, a few question:

  1. What is the purpose of sync in this case? Are you syncing the entire realm as a backup? Is this for cross-device enablement?

  2. What is your desired behavior when sync is disabled? I am assuming the user can still see the data but it is not backed up anywhere?

Hey Matt,

Roughly described, my app contains users personal duty events, which are downloaded from a company server and can manually be altered by the user, respectively he can add more information/events. So the answers to your questions are:

  1. The purpose is cross-device syncing. After downloading his duty events from the companys server on one device, this info should be synced to all of the users other devices. Also, if he e.g. adds a note to one event, this should be synced to all other devices.

  2. Well, with sync disabled, the user will just have his duty events on a single device. He can alter data, add notes, etc. but it will only be on this device and he will manually have to update each other device.

Appreciate your help!

Did you ever solve this? I have a similar scenario that I’m evaluating Realm for.