How open Realm offline?

Hi, I want open realm offline when data connection not available.

In mycode:

        User = await app.LogInAsync(Credentials.EmailPassword(xxx,yyy);

but app.LogIn(…) not available

how can I do?

Thanks
Luigi

Hi @Luigi_De_Giacomo ,

You cannot login if you’re not online, of course, as there’d be no way to check if the user is registered/authorised.

You can however work offline, after an initial login and sync, if you just refer to CurrentUser: this is documented here. The assumption is, of course, that you don’t call LogOutAsync(), as that would reset the user, and would require the app to be online for a new login.

Ok, when the app is already connected everything works: even if the connection is lost the changes are synchronized later.
But when starting the app on the smartphone, is there no way to open the local realm without connection and synchronize with the server later?

Hi @Luigi_De_Giacomo

Of course there is, please check the example here. What you can’t do is to use GetInstanceAsync, as that waits for a connection: GetInstance should be used instead.

Thanks Paolo!

app.CurrentUser != null solve the problem

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.