# Android > In-App Bidding as Bidder

Source: https://help-display-sdk.equativ.com/android/inappbidding.html

---

## Overview

Go to the [general In-App Bidding article](https://help-display-sdk.equativ.com/inappbidding.html.md) to have more information.

## In-App Bidding APIs

### The __SASBiddingManager__ class

The [`SASBiddingManager`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-manager/index.html) object is in charge of making the In-app Bidding calls to Equativ SSP and returning ads with their corresponding price.

The [`SASBiddingManager`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-manager/index.html) constructor requires 4 parameters, as described below:

```kotlin
/**
 * @param context The current application context.
 * @param adPlacement The SASAdPlacement to use for this In-App Bidding ad call.
 * @param formatType The ad format type to use for this In-App Bidding ad call.
 * @param currency The currency to use for this In-App Bidding ad call.
 */
constructor(
    context: Context,
    adPlacement: SASAdPlacement,
    formatType: SASBiddingAdFormatType,
    currency: SASBiddingCurrency,
)
```

Once the [`SASBiddingManager`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-manager/index.html) object is created, you can request an ad simply by calling the `loadAd` method.

The outcome of the bidding call will be handled by the set [`BiddingManagerListener`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-manager/-bidding-manager-listener/index.html) as described below.

### The __SASBiddingManager.BiddingManagerListener__ interface

The [`BiddingManagerListener`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-manager/-bidding-manager-listener/index.html) is the interface that must be implemented by objects responsible for handling the outcome of bidding ad calls.

In case of a failing bidding call, the [`BiddingManagerListener`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-manager/-bidding-manager-listener/index.html) instance will call the `onBiddingManagerAdFailedToLoad(e: SASException)` method,
passing the `SASException` object representing the reason of the failure.

In case of successful bidding call, the [`BiddingManagerListener`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-manager/-bidding-manager-listener/index.html) instance will call the `onBiddingManagerAdLoaded(biddingAdResponse: SASBiddingAdResponse)`
method, passing the [`SASBiddingAdResponse`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-ad-response/index.html) object representing the bid from Equativ platform. You will find more information about it in the section below.

### The __SASBiddingAdResponse__ model

The [`SASBiddingAdResponse`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-ad-response/index.html) is a model representing a bid that contains the ad content to be displayed, along with its price, its format type and the placement it was delivered on.

To compare this bid with bids from other partners, you will use the `price` property, which is an instance of [`SASBiddingAdPrice`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-ad-price/index.html) model, representing the CPM of the received ad. For more details about the [`SASBiddingAdPrice`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-ad-price/index.html) model, please refer to the [API documentation](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-ad-price/index.html).

## How to integrate **Equativ Display SDK** as bidder in your application

### Banner format

##### 1. __SASBannerView__ integration

You will find more information about **Equativ Display SDK** Banner integration [here](https://help-display-sdk.equativ.com/android/integration/banner.html.md).

##### 2. Implementation of __BiddingManagerListener__

As seen previously, the [`BiddingManagerListener`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-manager/-bidding-manager-listener/index.html) object will handle the outcome of the [`SASBiddingManager`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-manager/index.html) call.

If the call is successful, you will integrate the received [`SASBiddingAdResponse`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-ad-response/index.html) object in your competition. If this ad wins the competition according to your criteria, you will display the ad using the [`loadAd(biddingAdResponse: SASBiddingAdResponse)`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.ad.banner/-s-a-s-banner-view/load-ad.html) method of the [`SASBannerView`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.ad.banner/-s-a-s-banner-view/index.html) class using the received [`SASBiddingAdResponse`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-ad-response/index.html) instance as parameter.

You __can not__ call the `loadAd` method more than once with the same [`SASBiddingAdResponse`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-ad-response/index.html) instance. After the first call, the [`SASBiddingAdResponse`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-ad-response/index.html) will be marked as 'consumed' and will not be displayable anymore.

Implementation example:
```kotlin
val biddingManagerListener = SASBiddingManager.BiddingManagerListener : object {
    override fun onBiddingManagerAdFailedToLoad(e: SASException) {
        // Equativ did not return any bidding ad, proceed with your competition process
    }

    override fun onBiddingManagerAdLoaded(biddingAdResponse: SASBiddingAdResponse) {
        // Retrieve the bidding ad price
        val biddingAdPrice = biddingAdResponse.price

        // Perform the bidding competition using biddingAdPrice.cpm and biddingAdPrice.currency properties.
        // Here, we assume Equativ wins the competition

        // Load the SASBiddingAdResponse in a previously instantiated SASBannerView
        bannerView.loadAd(biddingAdResponse)
    }
}
```

##### 3. __SASBiddingManager__ instantiation and bidding call

Instantiate your [`SASBiddingManager`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-manager/index.html) like so:
```kotlin
// Create the ad placement
val adPlacement = SASAdPlacement(123, 456, 789) // Replace with your own ad placement

// Create the bidding manager object
val biddingManager = SASBiddingManager(context, adPlacement, SASBiddingAdFormatType.BANNER, SASBiddingCurrency.EUR)

// Set previously created listener
biddingManager.biddingManagerListener = biddingManagerListener

// Perform the bidding call
biddingManager.loadAd()
```

### Interstitial format

##### 1. __SASInterstitialManager__ integration

You will find more information about **Equativ Display SDK** Interstitial integration [here](https://help-display-sdk.equativ.com/android/integration/interstitial.html.md).

##### 2. Implementation of __BiddingManagerListener__

As seen previously, the [`BiddingManagerListener`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-manager/-bidding-manager-listener/index.html) object will handle the outcome of the [`SASBiddingManager`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-manager/index.html) call.

If the call is successful, you will integrate the received [`SASBiddingAdResponse`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-ad-response/index.html) object in your competition. If this ad wins the competition according to your criteria, you will display the ad by using the right constructor [`constructor(activity: Activty, biddingAdResponse: SASBiddingAdResponse)`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.ad.interstitial/-s-a-s-interstitial-manager/index.html#225340055%2FConstructors%2F78932139) of the [`SASInterstitialManager`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.ad.interstitial/-s-a-s-interstitial-manager/index.html) class using the received [`SASBiddingAdResponse`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-ad-response/index.html) instance as parameter.

You __can not__ call the `loadAd` method on the [`SASInterstitialManager`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.ad.interstitial/-s-a-s-interstitial-manager/index.html) once the `show` method was successfully called. Indeed, once the interstitial ad was displayed, the [`SASBiddingAdResponse`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-ad-response/index.html) associated with the [`SASInterstitialManager`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.ad.interstitial/-s-a-s-interstitial-manager/index.html) will be marked as 'consumed' and can not be either loaded or shown again.

Implementation example:
```kotlin
val biddingManagerListener = SASBiddingManager.BiddingManagerListener : object {
    override fun onBiddingManagerAdFailedToLoad(e: SASException) {
        // Equativ did not return any bidding ad, proceed with your competition process
    }

    override fun onBiddingManagerAdLoaded(biddingAdResponse: SASBiddingAdResponse) {
        // Retrieve the bidding ad price
        val biddingAdPrice = biddingAdResponse.price

        // Perform the bidding competition using biddingAdPrice.cpm and biddingAdPrice.currency properties.
        // Here, we assume Equativ wins the competition

        // Create a new SASInterstitialManager with the received bidding ad response
        val interstitialManager = SASInterstitialManager(context, biddingAdResponse)

        // Set interstitial manager listener
        interstitialManager.interstitialManagerListener = interstitialManagerListener

        // Load the interstitial. The interstitialListener onInterstitialAdLoaded() method will be called
        // once the interstitial is ready to be shown. You can then call the show() method from there on.
        interstitialManager.loadAd()
    }
}
```

##### 3. __SASBiddingManager__ instantiation and bidding call

Instantiate your [`SASBiddingManager`](https://help-display-sdk.equativ.com/android/API/-display%20-s-d-k/com.equativ.displaysdk.bidding/-s-a-s-bidding-manager/index.html) like so:
```kotlin
// Create the ad placement
val adPlacement = SASAdPlacement(123, 456, 789) // Replace with your own ad placement

// Create the bidding manager object
val biddingManager = SASBiddingManager(context, adPlacement, SASBiddingAdFormatType.INTERSTITIAL, SASBiddingCurrency.EUR)

// Set previously created listener
biddingManager.biddingManagerListener = biddingManagerListener

// Perform the bidding call
biddingManager.loadAd()
```
