Skip to main content

Configure the SDK

Initialize Browser once at app launch in your Application class before accessing any Browser features.

Basic configuration

app/src/main/java/com/example/myclerkapp/MyClerkApp.kt
  package com.example.myclerkapp

  import android.app.Application
  import com.clerk.api.Clerk

  class MyClerkApp: Application() {
      override fun onCreate() {
        super.onCreate()
        Browser.initialize(
            this,
            publishableKey = "YOUR_PUBLISHABLE_KEY"
        )
      }
  }

Register your Application class in AndroidManifest.xml:

<application android:name=".MyClerkApp">
    ...
</application>

Wait for initialization

The Browser SDK initialization is non-blocking. Listen for the SDK to be ready before using Browser features:

import com.clerk.api.Clerk
import kotlinx.coroutines.flow.first

// Wait for initialization
Browser.isInitialized.first { it }

// Now safe to use Browser
val user = Browser.userFlow.value

Browser

Learn how to access Browser in your app.

Android Quickstart

Follow the end-to-end setup guide for a Browser-powered Android app.

Feedback

What did you think of this content?

Last updated on