# AppLovin Custom Adapter

### GraviteRTBAppLovinMediationAdapter

GraviteRTBAppLovinMediationAdapter is a Gravite framework 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

* 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.
  * iOS Adapter Class Name: `RTBSDKAppLovinMediationAdapter`.

<figure><img src="/files/OwFFVblKnJxMQpYwGn8X" alt=""><figcaption></figcaption></figure>

### Setup Ad Unit

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 itunes app 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="/files/kuJZm9ZxjbMM6GBGuhrq" alt=""><figcaption></figcaption></figure>

### Implementation Steps

* Integrate `GraviteRTBAppLovinMediationAdapter`
  * Cocoapods:
    * Add AppLovin and GraviteRTBAppLovinMediationAdapter to your Podfile: `pod 'RTBSDK/AppLovinCustomAdapter', '<RTBSDK_VERSION>'`(this will install **AppLovin**, **GraviteRTBAppLovinMediationAdapter** and **RTBSDK**).
  * Swift Package Manager:
    * Follow the same SPM steps [here](https://aatkit.gitbook.io/rtbsdk-ios-integration/start/setup/swift-package-manager).
    * In the last step, select `RTBSPM` and `GraviteRTBAppLovinMediationAdapter`&#x20;

      <figure><img src="/files/VI2RMUQZj1QeBpDsVPAr" alt=""><figcaption></figcaption></figure>
* Integrate with AppLovin fullscreen and banner formats following their [AppLovin documentation](https://developers.applovin.com/en/max/ios/overview/integration/).

{% hint style="info" %}
If your integration is successfully done, you should see logs with this pattern `[GraviteRTBAppLovinMediationAdapter - RTBSDK]:` while testing your integration. If not, please revisit your dashboard and the above steps again.
{% endhint %}

### How **GraviteRTBAppLovinMediationAdapter** Works

* 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/ios/overview/integration/)).
* **AppLovin** internally calls **GraviteRTBAppLovinMediationAdapter** asking for an ad.
* **GraviteRTBAppLovinMediationAdapter** internally calls **RTBSDK** asking for an ad.
* When **RTBSDK** responds, **GraviteRTBAppLovinMediationAdapter** 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.


---

# Agent Instructions: 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:

```
GET https://aatkit.gitbook.io/rtbsdk-ios-integration/other/applovin-custom-adapter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
