> For the complete documentation index, see [llms.txt](https://popin.gitbook.io/popin-developer-hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://popin.gitbook.io/popin-developer-hub/how-to-start-and-join-a-popin-conference-using-the-android-sdk.md).

# How to Start and Join a Popin Conference using the Android SDK

This guide explains how to start and join a Popin conference using the **Popin Capture API** and the **Popin Android SDK**.\
You’ll first capture a customer using an API call, then use the SDK to initialize and start a conference between the customer and your agent.

***

### ⚙️ Prerequisites

Make sure you’re using **Popin Android SDK version 1.7.3** or higher.

***

### 🏗 Step 1: Add Popin SDK to Your Android Project

#### 1️⃣ Add JitPack Repository

In your **settings.gradle** file, add the following inside `dependencyResolutionManagement`:

```gradle
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
}
```

#### 2️⃣ Add Popin SDK Dependency

In your **module-level build.gradle** file:

```gradle
dependencies {
    implementation 'com.github.Springr-Creatives:PopinAndroidSDK:1.7.3'
}
```

💡 Use version **1.7.3 or above** for the latest fixes and features.

***

### 📜 Step 2: Configure AndroidManifest.xml

Add the following entries to your **AndroidManifest.xml**:

```xml
<meta-data
    android:name="to.popin.androidsdk.POPIN_TOKEN"
    android:value="<your_token_here>" />

<activity
    android:name="to.popin.androidsdk.call.CallActivity"
    android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|keyboardHidden"
    android:excludeFromRecents="true"
    android:exported="true"
    android:launchMode="singleTask"
    android:showWhenLocked="true"
    android:supportsPictureInPicture="true" />
```

🔁 Replace `<your_token_here>` with your **Popin API key** (available in your Popin Dashboard).\
This same key will be used in both API and SDK calls.

***

### 🧩 Step 3: Capture Customer via API

Use the **Capture API** to register a customer and generate a unique slug for the conference.

#### 🔹 Endpoint

`POST https://api.popin.to/api/capture`

#### 🔹 Example Request

```json
{
  "name": "Anubhav",
  "email": "anubhav.jaiswal@popin.to",
  "mobile": "9792521396",
  "country": "+91",
  "campaign": {
    "utm_source": "google",
    "pincode": "221007",
    "frequency": "daily"
  }
}
```

#### 🔹 Example Response

```json
{
  "status": 1,
  "customer_id": "MjA2MTI3",
  "slug": "3e21-a564",
  "url": "https://live.popin.to/3e21-a564",
  "message": "User captured successfully"
}
```

📌 Note down the **slug** (e.g., `"3e21-a564"`) — you’ll need it to start the conference.

***

### 📱 Step 4: Initialize and Start the Popin Conference

You can now initialize Popin and start the conference in one step.

#### Example Code

```java
Popin.init(MainActivity.this, "ashwin", "9876543217", new PopinInitListener() {
    @Override
    public void onInitComplete() {
        Popin.getInstance().startConference(
            12973, // Agent ID from Popin Dashboard
            "f470-6656", // Slug from Capture API response
            "557305ad2bd531ddf9e50d75daed5947d79eb81a", // API Key from Popin Dashboard
            new PopinConferenceEventListener() {
                @Override
                public void onConferenceJoined() {
                    Log.e("CONF", "JOINED");
                }

                @Override
                public void onConferenceFailed() {
                    Log.e("CONF", "FAILED");
                }
            }
        );
    }
});
```

#### Parameter Reference

* **Agent ID** → Your agent’s unique ID from the Popin Dashboard
* **Slug** → The value returned from the Capture API (`"3e21-a564"`, for example)
* **API Key** → Your Popin Dashboard API key

***

### 🔔 Step 5: Handle Conference Events

Use the `PopinConferenceEventListener` to handle join and failure events.

```java
@Override
public void onConferenceJoined() {
    Log.e("CONF", "JOINED");
    // Triggered when the agent successfully joins the conference
}

@Override
public void onConferenceFailed() {
    Log.e("CONF", "FAILED");
    // Triggered when the conference fails to connect or initialize
}
```

***

### ✅ Summary

| Step | Description                               |
| ---- | ----------------------------------------- |
| 1    | Add Popin SDK to your Android project     |
| 2    | Configure your AndroidManifest.xml        |
| 3    | Capture customer via API and get slug     |
| 4    | Initialize Popin and start the conference |
| 5    | Handle conference events                  |
