---
agentTools:
  projectIndex: https://developers.appnext.com/llms.txt
---

# Getting Started

## Overview

The Android SDK 2.0 enables mobile app developers to seamlessly integrate ad units into their applications and monetize their user base. The SDK is lightweight, easy to integrate, and provides robust tools for controlling and tracking ad performance.

**Supported ad units:**

* Banner (standard and smart resizing)
* Native ads
* Suggested Banner
* Interstitial
* FullScreenVideo
* Rewarded

More ad formats will be added in future releases.

<br />

***

## Getting Started

### Prerequisites

Before integrating the new Android SDK 2.0, ensure the following:

* **Minimum Android SDK version**: 24 (Android 7.0 Pie)
* **Gradle Plugin**: 7.0.0 or higher
* **Kotlin Compatibility**: Kotlin 1.5 or higher (if using Kotlin)

<br />

### Required Permissions

Add the following permission to your `AndroidManifest.xml`:

```kotlin
<uses-permission android:name="android.permission.INTERNET"/>
```

<br />

This permission is required to fetch and serve ads over the network.

<br />

***

## Installation

To add the Android SDK 2.0 to your Android project, follow these steps:

### Step 1: Add the Appnext Maven repository

In your project-level `build.gradle` (or` settings.gradle` in newer projects), include:

```kotlin
allprojects {  
    repositories {  
        maven {  
            url "https://dl.appnext.com"  
        }  
    }  
}
```

<br />

### Step 2: Add the SDK dependency

In your **app-level** `build.gradle` file:

```kotlin
dependencies {  
    implementation("com.appnext.sdk:appnext-sdk:3.0.0.16") // Use latest version  
}
```

<br />

> 📌
>
> The latest stable version is listed in the [SDK Version History](https://developers.appnext.com/changelog) section.

<br />

### Step 3: Sync your project

After updating your Gradle files, click "**Sync Now**" in Android Studio to apply the changes.

<br />

***

## Initialization

Before loading ads, you must initialize the Android SDK 2.0. It is recommended to do this once in your **Application** class or in the `onCreate` method of your **main Activity**.

### Example – Initialization in Application class:

```kotlin
class MyApp : Application() {
    override fun onCreate() {
        super.onCreate()
        AppnextSDK.getInstance().initialize(this.applicationContext)
    }
}
```

### Example – Initialization in MainActivity:

```kotlin
class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        AppnextSDK.getInstance().initialize(applicationContext)
    }
}
```

<br />

> ⚠️ Important
>
> Call `initialize()` **before** loading any ad units.

<br />

## GDPR & User Consent

To comply with data privacy regulations such as GDPR, developers can optionally set the user's consent status using the following method:

```kotlin
AppnextSDK.getInstance().setConsent(true)  // User has given consent  
AppnextSDK.getInstance().setConsent(false) // User has opted out
```

* **true** – User has provided consent and GAID may be used.
* **false** – User has not provided consent; GAID will not be sent.

> 📝This method is **optional**. If not used, the SDK will proceed without applying a specific consent flag.