Initialize SDK for multiple apps

Prev Next

If you have multiple apps, initialize the SDK with your app identifier so that the app's sessions, user data, and push notification targeting are attributed to the correct app. This method works the same way as the existing Initialize SDK method, with one additional appIdentifier parameter.

This method is available on Android SDK 17.3.0 or higher.

App identifier format

Your app identifier is provided by Insider One. It must follow these rules:

  • Only lowercase letters (a-z), digits (0-9), and underscores (_).

  • Must start with a lowercase letter or a digit.

  • At most 50 characters. Pattern: ^[a-z0-9][a-z0-9_]{0,49}$

  • Bundle-identifier style values such as com.acme.myapp are not valid.

An invalid app identifier does not block initialization. The SDK logs a warning, ignores the value, and initializes as if no app identifier was passed. In that case, the app's data is attributed to the partner's default app.

The following table shows the data type for the method's parameters.

Parameter

Data Type

Description

application

Application

Your Application class instance.

partnerName

String

Your partner name provided by Insider One. Use lowercase only.

appIdentifier

String

Your app identifier provided by Insider One. Must match ^[a-z0-9][a-z0-9_]{0,49}$.

Method signatures

Insider.Instance.init(Application application, String partnerName, String appIdentifier)
fun init(application: Application, partnerName: String, appIdentifier: String)

Method examples

Initialize the SDK in your Application class, as you do for the standard initialization.

import android.app.Application;
import com.useinsider.insider.Insider;

public class MyApplicationClass extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        // your_partner_name and your_app_identifier are provided by Insider One.
        Insider.Instance.init(this, "your_partner_name", "your_app_identifier");
    }
}
import android.app.Application
import com.useinsider.insider.Insider

class MyApplicationClass : Application() {
    override fun onCreate() {
        super.onCreate()
        // your_partner_name and your_app_identifier are provided by Insider One.
        Insider.Instance.init(this, "your_partner_name", "your_app_identifier")
    }
}

Make sure that you initialize the Insider SDK in your Application class. Avoid initializing it in an Activity class.

Initialization behavior

  • If the app identifier is invalid, the SDK logs a warning (visible on test devices), ignores the value, and initialization still completes.

  • The app identifier is fixed for the running session. A later init call with a different value is ignored and logged.

  • The app identifier is stored on the device. Calling the two-parameter Insider.Instance.init(application, partnerName) method does not remove a stored app identifier. We recommend always calling the three-parameter method once you start using it.

  • A partner change clears the stored app identifier: initializing with a different partner name, or calling reinit with a different partner name.

  • The existing Insider.Instance.init(application, partnerName) method is unchanged and remains fully supported.