> For the complete documentation index, see [llms.txt](https://docs.zigpoll.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zigpoll.com/installation/android-sdk.md).

# Android SDK

Show Zigpoll surveys inside your Android app. The SDK presents surveys in a native bottom sheet — you decide exactly when a survey appears by triggering it from code.

{% hint style="info" %}
Prefer to start from working code? Clone the ready-to-run [example app](https://github.com/zigpoll/zigpoll-android-example). SDK source: [zigpoll-android](https://github.com/zigpoll/zigpoll-android).
{% endhint %}

## Requirements

* Android 7.0 (API 24) or later
* Kotlin or Java

## Installation

The SDK is distributed via JitPack. Add the repository in `settings.gradle`:

```groovy
dependencyResolutionManagement {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}
```

Then add the dependency in your module's `build.gradle`:

```groovy
dependencies {
    implementation 'com.github.zigpoll:zigpoll-android:master-SNAPSHOT'
}
```

## Set up your survey

1. In the Zigpoll dashboard, create a survey.
2. Set the survey's delivery type to **API** (Delivery Settings → API).
3. Copy the survey ID from the survey's install section.

## Configure the SDK

In your `Application` subclass:

```kotlin
import com.zigpoll.Zigpoll

Zigpoll.configure(context, "YOUR_ACCOUNT_ID")
```

## Identify the user (recommended)

```kotlin
Zigpoll.identify("user_123", mapOf(
    "email" to "jane@example.com",
    "name" to "Jane"
))
```

Call `Zigpoll.logout()` when the user signs out.

## Trigger a survey

```kotlin
Zigpoll.trigger("SURVEY_ID", activity)
```

The survey appears in a bottom sheet. Responses are recorded slide by slide, so partial responses are captured even if the user dismisses the sheet mid-survey.

## Metadata

```kotlin
Zigpoll.setMetadata(mapOf("plan" to "pro"))
```

The SDK automatically includes `source=mobile-sdk`, `platform=android`, the SDK version, and your app version.

## Callbacks

```kotlin
Zigpoll.onComplete = { responses -> }
Zigpoll.onClose = { responses -> }
Zigpoll.onError = { error -> }
```

## Development builds

```kotlin
Zigpoll.configure(context, "YOUR_ACCOUNT_ID", preview = true)
```

With `preview = true`, surveys open and behave normally but responses are not billed or counted in your analytics.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.zigpoll.com/installation/android-sdk.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
