Android – Configure Adapty SDK

Learn how to import Adapty Android SDK in your app, configure it, and set up logging

Add the following to your Application class:

override fun onCreate() {
    Adapty.activate(applicationContext, "PUBLIC_SDK_KEY", observerMode = false, customerUserId = "YOUR_USER_ID")
public void onCreate() {
    Adapty.activate(getApplicationContext(), "PUBLIC_SDK_KEY", false, "YOUR_USER_ID");

Configurational options:

  • Public SDK key (required): found in your app settings in the Adapty Dashboard App settings > General.
  • Observer mode (optional): a boolean value controlling Observer mode. Turn it on if you handle purchases and subscription status yourself and use Adapty for sending subscription events and analytics.
  • Customer user ID (optional): an identifier of the user in your system. We send it in subscription and analytical events, to attribute events to the right profile. You can also find customers by customerUserId in the Profiles section.
    If you don't have user IDs in your app, you can omit this parameter or pass null.
    If you don't have a user ID at the time of Adapty initialization, you can set it later using .identify() method. Read more in the Identifying Users section.


Make sure you use the Public SDK key for Adapty initialization, the Secret key should be used for server-side API only.


SDK keys are unique for every app, so if you have multiple apps make sure you choose the right one.


Adapty logs errors and other important information to help you understand what is going on. There are five levels available:

  1. AdaptyLogLevel.NONE (default): won't log anything
  2. AdaptyLogLevel.ERROR: only errors will be logged
  3. AdaptyLogLevel.WARN: messages from the SDK that do not cause critical errors, but are worth paying attention to
  4. AdaptyLogLevel.INFO: various information messages
  5. AdaptyLogLevel.VERBOSE: any additional information that may be useful during debugging, such as function calls, API queries, etc.

You can set the log level in your app before configuring Adapty.

Adapty.logLevel = AdaptyLogLevel.VERBOSE

Redirecting the logging system messages

If you for some reason need to send messages from Adapty to your system or save them to a file, you can override the default behavior:

Adapty.setLogHandler { level, message ->
    //handle the log
Adapty.setLogHandler((level, message) -> {
    //handle the log