Interstitial Ads - san-sdk/sample GitHub Wiki
Interstitial ads provide full-screen experiences, commonly incorporating rich media to offer a higher level of interactivity compared to banner ads. Interstitials are typically shown during natural transitions in your app; for example, after completing a game level, or while waiting for a new view to load. Use the SANInterstitial
object and its associated listeners to fetch and display interstitial ads in your app.
Prerequisites
- Already has a PlacementId using the format
Interstitial
. - Follow our steps to Integrate the SAN SDK into your project.
- Integrated the SAN Ad SDK
Load Interstitial Ads in Your App
Step 1. Create an Interstitial Ad
SANInterstitial interstitial = new SANInterstitial(context, placementId);
interstitial.setAdLoadListener(new IAdListener.AdLoadListener() {
@Override
public void onAdLoaded(SANAd adWrapper) {
// Called when the ad for the given placementId has loaded and is ready to be shown.
}
@Override
public void onAdLoadError(AdError adError) {
// Called when a ad fails to load for the given placementId.
}
});
interstitial.setAdActionListener(new IAdListener.AdActionListener() {
@Override
public void onAdImpressionError(AdError error) {
// Called when a ad show failed.
}
@Override
public void onAdImpression() {
// Called when a ad shown
}
@Override
public void onAdClicked() {
// Called when interstitial is clicked
}
@Override
public void onAdCompleted() {
}
@Override
public void onAdClosed(boolean hasRewarded) {
// Called when a interstitial ad is closed.
}
});
interstitial.load();//Request Ad
Step 2. Display an Interstitial Ad
If isAdReady()
returns true, display the interstitial by calling the show()
method
if (interstitial.isAdReady()){
interstitial.show();
}
Step 3:Destory
When the interstitial Ad dismissed use the destroy()
interstitial.destroy();