πͺCustom Native Ad
Below are the steps to load and show a custom native ad on your app
AdRequestConfiguration.Builder configuration = AdRequestConfiguration.Companion.builder(context, "Your_placement_name");val configuration = AdRequestConfiguration.builder(context, "Your_placement_name")AdSterAdLoader.Companion.builder().withAdsListener(new MediationAdListener() {
@Override
public void onNativeCustomFormatAdLoaded(@NonNull MediationNativeCustomFormatAd ad) {
super.onNativeCustomFormatAdLoaded(ad);
if(ad.getCustomFormatId() == "123456"){
// Show native custom format for template Id 123456
} else if (ad.getCustomFormatId() == "654321") {
// Show native custom format for template Id 654321
}
}
@Override
public void onFailure(@NonNull AdError adError) {
//Handle failure callback here
}
}).withAdsEventsListener(new AdEventsListener() {
@Override
public void onAdClicked() {
//Handle ad click here
}
@Override
public void onAdImpression() {
//Handle ad impression here
}
@Override
public void onAdRevenuePaid(double revenue, @NotNull String adUnitId,@NotNull String network) {
// Callback which provides revenue and the network which provided it
}
}).build().loadAd(configuration.build());Last updated