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

# Android

> Install the AAR, use the DoubleData dialog, or render the supplied notice in your own UI.

## Install

[Download the Android AAR](https://doubledata.mintlify.site/sdk/downloads.md), rename it to `doubledata-proxy.aar`, and place it in `app/libs/`:

```kotlin theme={null}
dependencies {
    implementation(files("libs/doubledata-proxy.aar"))
}
```

Supports Android API 23+ and ARMv7, ARM64, x86, and x86\_64.

## Create a client

The SDK includes the DoubleData notice. Set only your app's connection settings and optional limits:

```java theme={null}
String configJSON = new JSONObject()
    .put("endpoint", sdkEndpoint)
    .put("developer_key", sdkEnrollmentKey)
    .put("session_duration_seconds", 3600)
    .toString();

DoubleDataClient client = new DoubleDataClient(configJSON,
    new DoubleDataClient.Observer() {
        public void onStatus(String json) { updateSharingStatus(json); }
        public void onError(Exception error) { showError(error.getMessage()); }
    });
```

Import `io.doubledata.DoubleDataClient` and `org.json.JSONObject`. Use your application-scoped SDK settings, not an account API key. [JSON configuration](https://doubledata.mintlify.site/sdk/configuration.md).

## Use the built-in dialog

```java theme={null}
enableButton.setOnClickListener(v -> client.requestConsentAndStart(this));
pauseButton.setOnClickListener(v -> client.stop());
withdrawButton.setOnClickListener(v -> client.withdrawConsent());
```

The dialog displays the supplied notice and clickable privacy link. Only **Enable sharing** permits a start. Decline, dismissal, or leaving the screen keeps sharing off.

## Render your own screen

Implement `io.doubledata.ConsentPresenter`:

```java theme={null}
client.requestConsentAndStart(new ConsentPresenter() {
    public String presentConsentJSON(String noticeJSON) throws Exception {
        return sharingScreen.showAndWait(noticeJSON);
    }
    public void cancel() { sharingScreen.cancel(); }
});
```

Here `sharingScreen` is your native UI bridge. The SDK calls it on a worker: post UI work to main, display the complete notice with your styling, and return `"accept"`, `"decline"`, or `"dismiss"` after the person's choice. `cancel()` must promptly dismiss and unblock with a nonaccepting result, including when called before the view opens.

## Close the session

Call `closeAsync()` when the sharing screen leaves the foreground. Await its result off the UI thread before replacing the client.

[Complete Activity](https://github.com/doubledata-proxy/docs/releases/download/sdk-v1.0.1/MainActivity.java) · [Application JSON](https://doubledata.mintlify.site/sdk/examples/application-sdk.json) · [Participation flow](https://doubledata.mintlify.site/sdk/consent.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.