Banner - 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 Banner object
// context: activity or context
// APP_ID: application id
// AD_UNIT_ID: ad unit id
mBanner = new AtmosplayBanner(context, APP_ID, AD_UNIT_ID);

// Set Banner size
// BannerSize:
//  - BANNER_320x50: request a Banner with a shape of 320dp x 50dp
//  - BANNER_728x90: request a Banner with a shape of 728dp x 90dp
//  - SMART_BANNER: request a Banner based on your device which if it is tablet the shape will be screen width x 90dp, otherwise, if it is landscpe model the shape will be screen width x 32sp, others will be screen width x 50dp

// (optional)Set Banner container
// When you set the container, the Banner is automatically filled into the container when it is ready then refresh the Banner at next banner is ready.
// When you do not set the container, you should get Banner view when banner is loaded and then put it into your container, also you should take care of it when it comes new Banner view is ready

// Load an advertising


// Destroy the Banner object

Add Listener

When you need some Banner lifecycle events like loaded, failed or clicked, you can do as follows:


BannerListener definition

interface BannerListener {
    // Fired when Banner is ready
    // !!note!! if you set a container before, the banner will be automatically filled into the container
    void onBannerPrepared(AtmosBannerView banner);
    // Fired when Banner load failed, you will get error code and error message
    void onBannerPreparedFailed(int code, String error);
    // Fired when Banner view was clicked
    void onBannerClicked();

## Other methods
// Set channel id, when you publish your app to different app market you may use it

The BannerSample file is the Banner sample code.