Navigation

Initialize the Realm App Client

Overview

The Realm Realm app client is the interface to the MongoDB Realm backend. It provides access to the authentication functionality, functions, and sync management.

Access the App Client

Pass the Realm app ID for your Realm app, which you can find in the Realm UI.

val appID = "<your app ID>" // replace this with your App ID
Realm.init(this) // context, typically an Activity
val app: App = App(AppConfiguration.Builder(appID).build())

Configuration

You can use the AppConfiguration Builder to control details of your App:

val appID = "<your app ID>" // replace this with your App ID
Realm.init(this) // context, typically an Activity
val app: App = App(AppConfiguration.Builder(appID)
      .baseUrl("https://realm.mongodb.com")
      .appName("My App")
      .appVersion("3.14.159")
      .requestTimeout(30, TimeUnit.SECONDS)
      .build())