Skip to main content

Getting Started with the Android SDK

appflags-sdk-android GitHub Repo stars

Initializing the AppFlags SDK

We suggest initializing the AppFlags SDK in the onCreate of your Application class or your MainActivity so that the SDK initializes as early as possible.

Client initialization

Initialize AppFlagsClient as shown below:

override fun onCreate() {
super.onCreate()

val user = AppFlagsUser("userKey")
AppFlagsClient.init(applicationContext, "YOUR_CLIENT_KEY", user)
}

User identification

The Android SDK requires an AppFlagsUser object to identify the user. This contains a userKey which is a unique string that identifies the user and does not change between sessions.

You can update the SDK with a new user if the user changes during the application lifecycle.