Interstitial - Atmosplay/AtmosplayAds-Android Wiki

Initialization and request

You should use the testing id in test phase. Testing id won't generate revenue. Please use official id when you release your App.

// Create interstitial object
// context: activity or context
// APP_ID: application ID
mInterstitial = AtmosplayInterstitial.init(context, APP_ID)

// Request ad
// AD_UNIT_ID: ad unit id
// AtmosplayAdLoadListener: you can get request events from the object's callbacks
mInterstitial.loadAd(AD_UNIT_ID, AtmosplayAdLoadListener)

AtmosplayAdLoadListener definition

Display and Destroy

// Show ad
// AD_UNIT_ID: the same with ad unit id which you use it to load ad
// AtmosplayAdListener: you can get request events from the object's callbacks
// To pre-load an ad may take several seconds, so it's recommended to initialize the SDK and load ads as early as possible. 
mInterstitial.show(AD_UNIT_ID, AtmosplayAdListener)

AtmosplayAdListener definition

// Destroy the ad instance
mInterstitial.destroy();

Listener

AtmosplayAdLoadListener definition

interface AtmosplayAdLoadListener {
    // Interstitial has been loaded
    void onLoadFinished();
    // Fail to load an ad
    void onLoadFailed(int errorCode, String msg);
}

AtmosplayAdListener definition

interface AtmosplayAdListener {
    // the ad game start playing
    void onVideoStart();

    // the ad game end, game landing page will showing
    void onVideoFinished();

    // note: Interstitial will not fire the function
    void onUserEarnedReward();

    // error occurs when showing ad
    void onAdsError(int code, String msg);

    // user click the install button
    void onLandingPageInstallBtnClicked();

    // ad's finally event
    void onAdClosed();
}

Other methods

// The SDK automatically loads the next advertisement after displayed an ad by default. 
// This method can be used to disable automatic loading of the next advertisement.
void setAutoLoadAd(boolean)
// This method can determin whether an add has been loaded.
boolean isReady(AD_UNIT_ID)
// This method can set 
void setChannelId()

The InterstitialSample file is the sample code for interstitial.