WindowAd - Atmosplay/AtmosplayAds-Android GitHub 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 WindowAd object and request ad
// context: activity or context
// APP_ID: application ID
// AD_UNIT_ID: ad unit id
mWindowAd = new AtmosplayWindowAd(context, APP_ID, AD_UNIT_ID);

// Set WindowAd listener
// WindowAdListener:you can get request events from the object's callbacks
mWindowAd.setWindowAdListener(WindowAdListener)

WindowAdListener definition

Display and Destroy

This method add the window ad to your screen.

show WindowAd

// Show WindowAd
// Before showing, please set the position coordinates and the width of the window
// activity: activity
// pointX: position coordinates X (Units are pixels)
// pointY: position coordinates Y (Units are pixels)
// width: width (Units are pixels)
mWindowAd.show(activity, pointX, pointY, width)

Destroy WindowAd:

// Destroy ad object
void destroy()

Add Listener

WindowAdListener definition

interface WindowAdListener {
    // WindowAd has been loaded
    void onWindowAdPrepared();
    // WindowAd load failed, you can read the message to find out what went wrong with the download.
    void onWindowAdPreparedFailed(int errorCode, String message);
    // the WindowAd start playing
    void onWindowAdStart();
    // the WindowAd playing end
    void onWindowAdFinished();
    // ad's finally event
    void onWindowAdClose();
    // user click the install button
    void onWindowAdClicked();
}

Other methods

// This method can determin whether any ads has been loaded.
boolean isReady()
// Close WindowAd view , If you need to display again after closing, please call the show WindowAd advertising interface
void closeWindowAd();

The WindowAdSample file is the Window sample code.