Amazon_Android_Banner - imobile/app-mediation GitHub Wiki
※以下の文書はAmazon Publisher ServicesのドキュメントをAmazonの許諾を得て転載したものです。
Banner ads for Android
Banner ads appear in either the top or bottom of your app’s layout. They remain on the screen while users are interacting with your app, and can automatically refresh during a session.
Follow these steps to add banner ads:
- In the Activity, make a request to APS. To do so, create an instance of
DTBAdSize
, and insert the ad size and the slotUUID. - Instantiate
DTBAdRequest
, and set the size to theDTBAdSize
object that you defined. - Call
loadAd()
to request APS for a bid. Only a single ad size and slotUUID is supported per bid request.
final DTBAdRequest loader = new DTBAdRequest();
loader.setSizes(new DTBAdSize("Your_Slot_Size", "Your_Slot_UUID"));
loader.loadAd(new DTBAdCallback() {
// No APS bid available
@Override
public void onFailure(AdError adError) {
Log.e("AdError", "Oops banner ad load has failed: " + adError.getMessage());
/** Please implement the logic to send ad request without our parameters if you want to
show ads from other ad networks when Amazon ad request fails **/
}
// APS bid returned
@Override
public void onSuccess(DTBAdResponse dtbAdResponse) {
/** Append the APS bid parameters to your ad server request. This portion will differ depending on your
ad server**/
}
});