Disable syncing


(Chris) #1

I am looking into databases and was wanting to know if Realm has an option to disable syncing. On my iOS/Android apps I am building, syncing will be a premium feature. I read the API docs and saw you can change the permissions of the user but that doesnt seem like the best way to stop a user from syncing. I basically want to have everything stored locally, then if they are a premium user I can enable syncing with the cloud. Is this possible?

I found this Github issue about it back in 2017 where a dev said this was on their backlog but didnt know when it would be added.


(Brian Munkholm) #2

This has unfortunately not been added yet. So you would just have to copy the data from a local to a synced Realm.


#3

Not sure if this will work but perhaps in the method which creates the realm instance you could do your premium check and call session.Stop?

The method signature may vary depending on the realm sdk you are using in your app.

Like most devs using realm we have a paid and unpaid version of our app. I think we are fairly typical in that we don’t stop sync; we disable premium features in the UI. This works well because unpaid users can see the paid features are disabled.


(Chris) #4

Yeah we thought about just syncing for everyone but this is more of a side project with a friend so we wouldnt want to have to pay for all the free users syncing data. I dont think it would be too expensive but I’m not sure which is why I was curious as to preventing them from storing their data on the cloud.