Integrate Equativ Display SDK as an In-App Bidding partner on Android
Table of contents
Overview
Go to the general In-App Bidding article to have more information.
In-App Bidding APIs
The SASBiddingManager class
The SASBiddingManager
object is in charge of making the In-app Bidding calls to Equativ SSP and returning ads with their corresponding price.
The SASBiddingManager
constructor requires 4 parameters, as described below:
/**
* @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
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
as described below.
The SASBiddingManager.BiddingManagerListener interface
The BiddingManagerListener
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
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
instance will call the onBiddingManagerAdLoaded(biddingAdResponse: SASBiddingAdResponse)
method, passing the SASBiddingAdResponse
object representing the bid from Equativ platform. You will find more information about it in the section below.
The SASBiddingAdResponse model
The SASBiddingAdResponse
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
model, representing the CPM of the received ad. For more details about the SASBiddingAdPrice
model, please refer to the API documentation.
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.
2. Implementation of BiddingManagerListener
As seen previously, the BiddingManagerListener
object will handle the outcome of the SASBiddingManager
call.
If the call is successful, you will integrate the received SASBiddingAdResponse
object in your competition. If this ad wins the competition according to your criteria, you will display the ad using the loadAd(biddingAdResponse: SASBiddingAdResponse)
method of the SASBannerView
class using the received SASBiddingAdResponse
instance as parameter.
You can not call the loadAd
method more than once with the same SASBiddingAdResponse
instance. After the first call, the SASBiddingAdResponse
will be marked as ‘consumed’ and will not be displayable anymore.
Implementation example:
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
like so:
// 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.
2. Implementation of BiddingManagerListener
As seen previously, the BiddingManagerListener
object will handle the outcome of the SASBiddingManager
call.
If the call is successful, you will integrate the received SASBiddingAdResponse
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)
of the SASInterstitialManager
class using the received SASBiddingAdResponse
instance as parameter.
You can not call the loadAd
method on the SASInterstitialManager
once the show
method was successfully called. Indeed, once the interstitial ad was displayed, the SASBiddingAdResponse
associated with the SASInterstitialManager
will be marked as ‘consumed’ and can not be either loaded or shown again.
Implementation example:
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
like so:
// 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()