Docs

Android quickstart (Kotlin)

Add Sovaria to an Android app: install with Gradle, connect, sign in, read data, and keep the session in the Keystore.

Updated Oct 17, 2026Open in console
  1. Install

    implementation("in.sovaria:sovaria:1.0.0")
  2. Register your app

    Console › Authentication › Mobile › Apps: add the Android package name (applicationId) and signing-certificate SHA-256 (from ./gradlew signingReport), and a redirect URI such as com.example.app://auth-callback.

  3. Connect

    import `in`.sovaria.*
    
    val sovaria = Sovaria.initialize(
        url = "https://<ref>.sovarias.in",          // Project settings › API
        anonKey = "svr_anon_…",                     // public; safe to ship in the app
        storage = KeystoreStore(context),          // EncryptedSharedPreferences (see below)
        device = SovariaDevice(id = deviceId, platform = "android", name = deviceName),
    )
  4. Keep the session in the Keystore

    class KeystoreStore(context: Context) : SessionStorage {
        // back with EncryptedSharedPreferences
        override suspend fun read(key: String): String? { /* … */ return null }
        override suspend fun write(key: String, value: String) { /* … */ }
        override suspend fun delete(key: String) { /* … */ }
    }
  5. Sign in and use data

    sovaria.auth.signInWithPassword("a@b.co", password)
    
    val todos = sovaria.db.select("todos", where = mapOf("done" to false), orderBy = "created_at", limit = 20)
    sovaria.files.upload("avatars", "${sovaria.auth.currentSession?.userId}/me.png", bytes, contentType = "image/png")
    
    val channel = sovaria.realtime.channel("room:42", onMessage = { println(it) })
    channel.send(mapOf("text" to "hi"))

Every operation

sovaria.api.call(method, path, …) reaches every Sovaria operation, generated from the same description as the other SDKs. Ergonomic wrappers: auth, db, files, functions, realtime.

Errors are SovariaException with status, code and a plain message. Coroutines + java.net.http; needs JDK 11+ (Android 8+/API 26+; on older Android, supply your own transport).

Something unclear or missing on this page?Tell us