App

interface App

An App is the main client-side entry point for interacting with an Atlas App Services Application.

The App can be used to:

  • Register and authenticate users.

  • Synchronize data between the local device and Atlas using Device Sync.

This can be done as shown below:

    class MyApplication {
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

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
abstract val currentUser: User?

Returns the current user that is logged in and still valid.

Link copied to clipboard

Wrapper for interacting with functionality related to users either being created or logged in using the AuthenticationProvider.EMAIL_PASSWORD identity provider.

Link copied to clipboard
abstract val sync: Sync

Returns a Device Sync manager that control functionality across all open realms associated with this app.

Functions

Link copied to clipboard
abstract fun allUsers(): Map<String, User>

Returns all known users that are either User.State.LOGGED_IN or User.State.LOGGED_OUT. Only users that at some point logged into this device will be returned.

Link copied to clipboard

Create a Flow of AuthenticationChange-events to receive notifications of updates to all app user authentication states: login, logout and removal.

Link copied to clipboard
abstract fun close()

Close the app instance and release all underlying resources.

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.