> For the complete documentation index, see [llms.txt](https://aatkit.gitbook.io/rtbsdk-android-integration/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aatkit.gitbook.io/rtbsdk-android-integration/other/applovin-custom-adapter.md).

# AppLovin Custom Adapter

RTBSDKMediationAdapter is a library that implements [AppLovin custom adapter](https://developers.applovin.com/en/max/demand-partners/building-a-custom-adapter). It supports the following ad formats:

* Banners
* Fullscreen
* Rewarded Video
* Native ads

### Add Custom SDK Network <a href="#add-custom-sdk-network" id="add-custom-sdk-network"></a>

* In the MAX Dashboard, select [MAX > Mediation > Manage > Networks](https://dash.applovin.com/o/mediation/networks/). Then click "Click here" to add a Custom Network at the bottom of the page. The Create Custom Network page appears. Add the information about RTBSDK custom network:
  * Network Type: choose SDK.
  * Name: RTBSDK.
  * Android / Fire OS Adapter Class Name: `com.applovin.mediation.adapters.RTBSDKMediationAdapter`.

<figure><img src="https://1695729140-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGGn4NkMRraw9h70TAjxK%2Fuploads%2FUMVo2AbHkJ8GsZG4VqOj%2F1.png?alt=media&amp;token=ec0381cd-26f9-4bac-a34c-e733096c9aac" alt=""><figcaption></figcaption></figure>

### Setup Ad Unit <a href="#setup-a-d-unit" id="setup-a-d-unit"></a>

Please contact your Gravite account manager to agree on the following parameters, as some need to be created on our end.

* Set the "**App ID**" to the apps bundle ID.
* Set the "**placement ID**" to the Gravite Marketplace placement ID as forwarded to you by your Gravite account manager.
* Set the seller id and the bid floor values in the "**Custom Parameters**" field to `{"sellerId": "<SELLER_ID_VALUE>", "bidFloor": "<BID_FLOOR_VALUE>" }`where `SELLER_ID_VALUE` is the seller id value and `BID_FLOOR_VALUE` is the bid floor value.

<figure><img src="https://1695729140-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGGn4NkMRraw9h70TAjxK%2Fuploads%2Fxfig0Vvg25IIR5wr2gKd%2FPlacementId.png?alt=media&amp;token=c4cac722-a97f-4def-9c53-98157916f2ed" alt=""><figcaption></figcaption></figure>

### Implementation Steps <a href="#implementation-steps" id="implementation-steps"></a>

* Add the RTB SDK repository to your repositories list

```gradle
allprojects {
    repositories {
        google()
        mavenCentral()
        //... other repositories you use
        maven {
            url 'https://android-sdk-rtb.gravite.net/maven'
        }
    }
}
```

* Add the AppLovin adapter dependency:

```gradle
dependencies {
    //... other project dependencies
    implementation ('com.rtb.sdk:RTB-SDK-AppLovinMediationAdapter:<SDK_VERSION>') {
        transitive = true
    }
}
```

{% hint style="info" %}
This will install both the mediation adapter and RTB SDK. Please note that the version of the adapter corresponds to the used version of RTB SDK.
{% endhint %}

* Integrate with AppLovin fullscreen and banner formats following the [AppLovin documentation](https://developers.applovin.com/en/max/android/overview/integration/).

### How **GraviteRTBAppLovinMediationAdapter** Works <a href="#how-gravitertbapplovinmediationadapter-works" id="how-gravitertbapplovinmediationadapter-works"></a>

* The publisher requests an ad (Banner or Fullscreen) normally from AppLovin SDK (To learn how to request an ad from AppLovin, please visit [AppLovin documentation](https://developers.applovin.com/en/max/android/overview/integration/)).
* **AppLovin** internally calls **RTBSDKMediationAdapter** asking for an ad.
* **RTBSDKMediationAdapter** internally calls **RTBSDK** asking for an ad.
* When **RTBSDK** responds, **RTBSDKMediationAdapter** would notify **AppLovin** with the response using the AppLovin custom adapter delegate methods. And in return, AppLovin will notify you of the response using the normal AppLovin callback.
