Repository navigation
Showing Interstitial Ads
sdk-jenkins edited this page Mar 10, 2022
·
25 revisions
- Project Setup
- Showing Interstitial Ads
- Showing Rewarded Interstitial Ads
- Showing Banner Ads
- Privacy Laws
- SDK API Details
- Publisher Reporting API
Once you've performed the required project setup, you can display an AdColony interstitial ad in your app in a few easy steps:
First, make sure you have imported the AdColony library:
import com.adcolony.sdk.*;Next, in your Activity's onCreate method, call configure like so:
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
AdColony.configure(this, APP_ID);
...
}Replace APP_ID and ZONE_IDS with your app and zone ids gathered from the AdColony Dashboard (please refer to "Publisher Apps & Zones Setup" for help).
Next, create an AdColonyInterstitialListener and request an ad. This request should take place sometime before you plan on displaying the interstitial.
AdColonyInterstitialListener listener = new AdColonyInterstitialListener() {
@Override
public void onRequestFilled(AdColonyInterstitial ad) {
/** Store and use this ad object to show your ad when appropriate */
}
};
AdColony.requestInterstitial(ZONE_ID, listener);Using the ad object passed back via the AdColonyInterstitialListener, show your ad object when appropriate:
ad.show();
Made with ❤️ in Seattle