Follow the instructions below to set up Amazon for Android.
Add the following code to your app's build.gradle
file inside the dependencies section:
implementation 'com.amazon.android:aps-sdk:9.7.0'
implementation 'ai.meson.sdk.mediation:aps:9.7.0.0-beta4'
Initialize the Amazon SDK.
AdRegistration.getInstance(APS_APP_ID, activityContext)
AdRegistration.getInstance(APS_APP_ID, this);
Use the setAdNetworkInfo
method to pass the mediator.
AdRegistration.setAdNetworkInfo(DTBAdNetworkInfo(DTBAdNetwork.OTHER))
AdRegistration.setAdNetworkInfo(new DTBAdNetworkInfo(DTBAdNetwork.OTHER));
To integrate Amazon Banner ads into Meson, load the Amazon ad and pass the DTBAdResponse
or AdError
into the instance of MesonBanner
. See the sample code below:
val loader = DTBAdRequest()
loader.setSizes(DTBAdSize(YOUR_SLOT_WIDTH, YOUR_SLOT_HEIGHT, "YOUR_SLOT_UUID"))
loader.loadAd(object : DTBAdCallback {
override fun onFailure(adError: AdError) {
val map = mutableMapOf<String, Any>()
map["APS"] = adError
mesonBanner.setHeaderBids(map)
mesonBanner.load()
}
override fun onSuccess(dtbAdResponse: DTBAdResponse) {
val map = mutableMapOf<String, Any>()
map["APS"] = dtbAdResponse
mesonBanner.setHeaderBids(map)
mesonBanner.load()
}
})
final DTBAdRequest adLoader = new DTBAdRequest();
adLoader.setSizes(new DTBAdSize(YOUR_SLOT_WIDTH, YOUR_SLOT_HEIGHT, "YOUR_SLOT_UUID"));
adLoader.loadAd(new DTBAdCallback() {
@Override
public void onFailure(AdError adError) {
Map<String, Object> map = new HashMap<>();
map.put("APS", adError);
mesonBanner.setHeaderBids(map);
mesonBanner.load();
}
@Override
public void onSuccess(DTBAdResponse dtbAdResponse) {
Map<String, Object> map = new HashMap<>();
map.put("APS", dtbAdResponse);
mesonBanner.setHeaderBids(map);
mesonBanner.load();
}
});
For the auto-refresh banner ads, you must load and pass the Amazon DTBAdResponse
or AdError
in onHeaderBidExpired
callback. See the sample code below:
object : MesonBannerAdListener() {
...
override fun onHeaderBidExpired(ad: MesonBanner) {
// load amazon ad
// pass the Amazon DTBAdResponse or AdError by calling MesonBanner#setHeaderBids
}
...
}
new MesonBannerAdListener() {
...
@Override
public void onHeaderBidExpired(@NonNull MesonBanner mesonBanner) {
// load amazon ad
// pass the Amazon DTBAdResponse or AdError by calling MesonBanner#setHeaderBids
}
...
}
To integrate Amazon Interstitial ads into Meson, load the Amazon ad and pass the DTBAdResponse
or AdError
into the instance of MesonInterstitial
. See the sample code below:
val loader = DTBAdRequest()
loader.setSizes(DTBInterstitialAdSize("YOUR_SLOT_UUID"))
loader.loadAd(object : DTBAdCallback {
override fun onFailure(adError: AdError) {
val map = mutableMapOf<String, Any>()
map["APS"] = adError
mesonInterstitial.setHeaderBids(map)
mesonInterstitial.load()
}
override fun onSuccess(dtbAdResponse: DTBAdResponse) {
val map = mutableMapOf<String, Any>()
map["APS"] = dtbAdResponse
mesonInterstitial.setHeaderBids(map)
mesonInterstitial.load()
}
})
final DTBAdRequest adLoader = new DTBAdRequest();
adLoader.setSizes(new DTBInterstitialAdSize("YOUR_SLOT_UUID"));
adLoader.loadAd(new DTBAdCallback() {
@Override
public void onFailure(AdError adError) {
Map<String, Object> map = new HashMap<>();
map.put("APS", adError);
mesonInterstitial.setHeaderBids(map);
mesonInterstitial.load();
}
@Override
public void onSuccess(DTBAdResponse dtbAdResponse) {
Map<String, Object> map = new HashMap<>();
map.put("APS", dtbAdResponse);
mesonInterstitial.setHeaderBids(map);
mesonInterstitial.load();
}
});
To integrate Amazon video ads into Meson, load the Amazon ad and pass the DTBAdResponse
or AdError
into the instance of MesonInterstitial
. See the sample code below:
val loader = DTBAdRequest()
loader.setSizes(DTBVideo(PLAYER_WIDTH, PLAYER_HEIGHT, "YOUR_SLOT_UUID"))
loader.loadAd(object : DTBAdCallback {
override fun onFailure(adError: AdError) {
val map = mutableMapOf<String, Any>()
map["APS"] = adError
mesonInterstitial.setHeaderBids(map)
mesonInterstitial.load()
}
override fun onSuccess(dtbAdResponse: DTBAdResponse) {
val map = mutableMapOf<String, Any>()
map["APS"] = dtbAdResponse
mesonInterstitial.setHeaderBids(map)
mesonInterstitial.load()
}
})
final DTBAdRequest adLoader = new DTBAdRequest();
adLoader.setSizes(new DTBVideo(PLAYER_WIDTH, PLAYER_HEIGHT,"YOUR_SLOT_UUID"));
adLoader.loadAd(new DTBAdCallback() {
@Override
public void onFailure(AdError adError) {
Map<String, Object> map = new HashMap<>();
map.put("APS", adError);
mesonInterstitial.setHeaderBids(map);
mesonInterstitial.load();
}
@Override
public void onSuccess(DTBAdResponse dtbAdResponse) {
Map<String, Object> map = new HashMap<>();
map.put("APS", dtbAdResponse);
mesonInterstitial.setHeaderBids(map);
mesonInterstitial.load();
}
});