Realm Cloud with Xamarin.Forms


#1

Hi there, I just finished my first Realm-Project with Xamarin and a local database. Now I want to hook it up to the realm cloud. I already have beta access. Is there an example on how to do that?


#2

We don’t have a Xamarin tutorial yet, but we have an example app here: https://github.com/realm/realm-tasks/tree/master/RealmTasks%20Xamarin.

There’s minimal effort required to enable cloud synchronization for an app that is already using Realm. It boils down to replacing the argument of your Realm.GetInstance calls with a SyncConfiguration instance. You can read up on it in the docs, but if you have any questions, feel free to ask them here and we’ll help.


#3

@nirinchev In this sample app, the developer used IList instead of observableCollection. Is this recommended? on my app I have been using observableCollection and I am getting all the changes to the list using on property change.

But, when I used Realm with observableCollection, the realm objects will not reflect the changes on the UI immediately.

In the documentation, it says

Using collections of supported objects is done by declaring a property of type IList where T is any supported type

Does that means that I can’t use observableCollection?
And must I use the RisePropertyChange?


#4

Realm’s collections are observable intrinsically, so they’ll automatically raise the CollectionChanged event. So no, you cannot use ObservableCollection, but you should get the same effect by using IList.