> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.qonversion.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Launch analytics mode Android

## 1. Launch SDK

Initialize the SDK:

```java theme={null}
import com.qonversion.android.sdk.Qonversion;
import com.qonversion.android.sdk.QonversionConfig;
import com.qonversion.android.sdk.Qonversion.dto.QLaunchMode;

public class App extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        final QonversionConfig qonversionConfig = new QonversionConfig.Builder(
                this,
                "[projectKey]",
                QLaunchMode.Analytics
        ).build();
        Qonversion.initialize(qonversionConfig);
    }
}
```

```kotlin theme={null}
import com.qonversion.android.sdk.Qonversion
import com.qonversion.android.sdk.QonversionConfig
import com.qonversion.android.sdk.Qonversion.dto.QLaunchMode

public class App : Application {
    override fun onCreate() {
        super.onCreate()
        val qonversionConfig = QonversionConfig.Builder(
            this,
            "[projectKey]",
            QLaunchMode.Analytics
        ).build()
        Qonversion.initialize(qonversionConfig)
    }
}
```

## 2. Sync Purchases

1. Check whether you have set your products up correctly. Make your GooglePlay subscriptions backwards compatible with having the best possible accuracy in Qonversion. <a href="/docs/android-in-app-products" target="_blank">Learn more here</a>

2. While you are using Qonversion SDKs in Analytics Mode, in-app purchases implementation is entirely on your side. Please remember to make sure you consume and acknowledge purchases to attribute them to users. **Otherwise, the purchases will be automatically refunded in 3 days.** See the official Android Developer documentation for <a href="https://developer.android.com/google/play/billing/integrate#process" target="_blank">processing purchase details</a>.

3. Sync data with Qonversion in your current purchase flow. Call `syncPurchases()` after every purchase.

```java theme={null}
Qonversion.getSharedInstance().syncPurchases();
```

```kotlin theme={null}
Qonversion.shared.syncPurchases()
```

> 📘 Please, do not use the [Google Play Billing AIDL](https://developer.android.com/google/play/billing/integrate) library to integrate Qonversion SDK with your application. It was deprecated and is not supported by Qonversion SDK.

## 3. (Optional) Set User ID

If you want to implement cross-platform (Android, IOS, and Web) user entitlement management, please, follow the [User Identity guide](/docs/user-identifiers#3-user-identity).

To match Qonversion revenue events to users in <a href="/docs/integrations-overview" target="_blank" rel="noopener">third-party tools</a>, you need to set the identical user IDs in all of them:

```java theme={null}
Qonversion.getSharedInstance().setProperty(QUserProperty.CustomUserId, "yourSideUserID");
```

```kotlin theme={null}
Qonversion.shared.setProperty(QUserProperty.CustomUserId, "yourSideUserID")
```

The user ID improves the quality of events matching to the platforms where event attribution is not exclusively based on GAID.

## 4. (Optional) Set ASID (App set ID, Android 12+ only)

On Android 12+, you can provide an App set ID to have it used in <a href="/docs/integrations-overview" target="_blank" rel="noopener">Qonversion integrations</a>.

Add `com.google.android.gms:play-services-appset` as the dependency to your project and write the following code.

```java theme={null}
final AppSetIdClient client = AppSet.getClient(context);
final Task<AppSetIdInfo> task = client.getAppSetIdInfo();
task.addOnSuccessListener(info -> {
    final String id = info.getId();
    Qonversion.getSharedInstance().setProperty(QUserProperty.AppSetId, id);
});
```

```kotlin theme={null}
val client = AppSet.getClient(requireContext())
client.appSetIdInfo.addOnSuccessListener { info: AppSetIdInfo ->
    Qonversion.shared.setProperty(QUserProperty.AppSetId, info.id)
}
```
