App

interface App

An App is the main client-side entry point for interacting with a MongoDB Realm App.

The App can be used to:

  • Register and authenticate users.

  • Synchronize data between the local device and a backend Realm App with synchronized realms.

To create an app that is linked with a remote Realm App, initialize Realm and configure the App as shown below:

    class MyRealmAppClass {
val app: App = App.create(<APP_ID>)
val realm: Realm

init {
realm = runBlocking {
val user = app.login(Credentials.anonymous())
val config = SyncConfiguration.Builder(
user = user,
partitionValue = "my-partition"
schema = setOf(YourRealmObject::class),
).build()

Realm.open(config)
}
}
}

Types

Companion
Link copied to clipboard
object Companion

Functions

login
Link copied to clipboard
abstract suspend fun login(credentials: Credentials): User
Log in as a user with the given credentials associated with an authentication provider.

Properties

configuration
Link copied to clipboard
abstract val configuration: AppConfiguration
currentUser
Link copied to clipboard
abstract val currentUser: User?
Returns the current user that is logged in and still valid.
emailPasswordAuth
Link copied to clipboard
abstract val emailPasswordAuth: EmailPasswordAuth
Wrapper for interacting with functionality related to users either being created or logged in using the AuthenticationProvider.EMAIL_PASSWORD identity provider.