FloatAd - 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 FloatAd object
// context: activity or context
// APP_ID: application ID
mFloatAd = AtmosplayFloatAd.init(context, APP_ID);

// Request FloatAd
// AD_UNIT_ID: ad unit id
// AtmosplayAdLoadListener: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. 
mFloatAd.loadAd(AD_UNIT_ID, AtmosplayAdLoadListener)

AtmosplayAdLoadListener definition

Display and Destroy

This method add the float ad to your screen.

warning:

  1. if you want to update the position, call the updatePointAndWidth(activity, pointX, pointY, width); please.
  2. if you want to show again after hiding, call the showAgainAfterHiding(); please.

show FloatAd

// Before showing, please set the position coordinates of the buoy ad display and the width of the buoy button
// pointX: Position coordinates X (pixels)
// pointY: Position coordinates Y (pixels)
// width: width (pixels)
mFloatAd.setPointAndWidth(pointX, pointY, width)

// Show FloatAd
// activity: activity
// AD_UNIT_ID: the same with ad unit id which you use it to load ad
// FloatAdListener: you can get show events from the object's callbacks
mFloatAd.show(activity, AD_UNIT_ID, FloatAdListener)

FloatAdListener definition

Update FloatAd position coordinates and width

// Update FloatAd position coordinates and width
// activity: activity
// pointX: position coordinates X (pixels)
// pointY: position coordinates Y (pixels)
// width: width (pixels)
updatePointAndWidth(activity, pointX, pointY, width);

Destroy FloatAd:

// Destroy ad object
void destroy()

Add Listener

AtmosplayAdLoadListener definition

interface AtmosplayAdLoadListener {
    // FloatAd has been loaded
    void onLoadFinished();
    // FloatAd load failed, you can read the message to find out what went wrong with the download.
    void onLoadFailed(int errorCode, String message);
}

FloatAdListener definition

interface FloatAdListener {
    // the ad game start playing
    void onFloatAdStartPlaying();

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

    // This is a callback of completing the whole event (showing, playing, quitting from landing page), which means the reward shall be given
    void onUserEarnedReward();

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

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

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

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)
// hidden FloatAd button view 
void hiddenFloatAd();
// Show hidden FloatAd button view again
// Then the user will see the ad again.
void showAgainAfterHiding();

The FloatAdSample file is the FloatAd sample code.