Realm Offline/Airplane mode


#1

Hello,

I’m working on a realm app. There are some tables in my realm object server. App basically fetch data from those tables and show up in list views in app. On launching, it authenticates realm admin user in background and create realm instance that app uses for CRUD operations.

My question is: Realm work offline which I know very well. Does it need internet connection on launching to get the user authenticated?

  1. On launching first time
  2. Let suppose, user launch the app, uses it for some time and then remove it from background and launch again from home screen of phone.

Please consider both situations in offline/airplane mode.

What I have tested it:-

User launched app(online) and get realm instance, then go offline, it works well. syncing does not get affected then.

but do we need internet connection to get realm admin authentication everytime?

Please suggest.


#2

You need internet connection only the very first time a user has to login. After that, their identity and refresh tokens are persisted, so even if they subsequently launch the app while being offline, they won’t need to reauthenticate. Check out the Working with Users section of the docs for more information on User.Current and User.AllLoggedIn.


#3

Can someone explain the connection code that needs to be implemented as part of the app startup sequence so this works.