๐Ÿ—‚๏ธ
ONE AdMax Developer Guides
EN
EN
  • 00. about ONE AdMax
  • 01. How to Issue a Media Key
  • 02. How to Issue a Placement Key
  • 03. SDK for Java
    • 3-1. Rewarded Video Ads
    • 3-2. Interstitial Ads
    • 3-3. Banner Ads
    • 3-4. Interstitial Video Ads (Non Reward)
  • 04. Unity-Plugin Guide
    • 4-1. Rewarded Video Ads for Unity
    • 4-2. Interstitial Ads for Unity
    • 4-3. Banner Ads for Unity
    • 4-4. Interstitial Video Ads for Unity (Non Reward)
  • 05. Flutter-Plugin Guide
    • 5-1. ๋ณด์ƒํ˜• ๋น„๋””์˜ค ๊ด‘๊ณ  for Flutter
    • 5-2. ์ „๋ฉด ๊ด‘๊ณ  for Flutter
    • 5-3. ๋ฐฐ๋„ˆ ๊ด‘๊ณ  ๊ตฌํ˜„ํ•˜๊ธฐ
    • 5-4. ์ „๋ฉด ๋น„๋””์˜ค ๊ด‘๊ณ  for Flutter (๋น„๋ณด์ƒํ˜•)
  • ๐Ÿ“ŒStarting Mediation
  • ONE AdMax SDK Error Codes
  • SDK Version ์•ˆ๋‚ด ์‚ฌํ•ญ
    • SDK 1.2.0
    • SDK 1.0.2
Powered by GitBook
On this page
  • Create a banner ad.
  • XML declarative method.
  • Imperative (code) method.
  • Set the banner PLACEMENT ID.
  • Banner Size
  • Banner refresh interval
  • Banner network schedule timeout setting
  • Banner animation settings
  • Banner background color settings
  • Banner request
  • Banner interruption
  • Banner visibility status
  • Banner event listener
  • Banner onPause / onResume
  • Banner Mediation
  • Banner sample code
  1. 03. SDK for Java

3-3. Banner Ads

A banner is the most common form of advertising, displayed as a strip at the top or bottom of an app.

Create a banner ad.

Banner ads can be implemented either declaratively or imperatively.

XML declarative method.

Add the view where the banner ad will be displayed to the Layout.xml file in use.

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#ffffff"
    android:orientation="vertical"> 
        <!-- Banner View -->         
       <com.oneadmax.global.OAMBanner
            android:id="@+id/banner"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
</LinearLayout>

Add the instance formed in XML to the code.

private OAMBanner banner;
 
@Override
protected void onCreate( Bundle savedInstanceState ){
    ...
    banner = (OAMBanner)findViewById(R.id.banner);
    ...
}

Imperative (code) method.

Without using XML, you can create a banner ad through the source code context using commands.

private OAMBanner banner;
 
@Override
protected void onCreate( Bundle savedInstanceState ){
    ...
    // ๋ฒ ๋„ˆ ๊ด‘๊ณ ๊ฐ€ ๋ณด์ด๊ฒŒ ๋  Activity์™€, ์ƒ๋‹จ ๋˜๋Š” ํ•˜๋‹จ์— ์ƒ์„ฑํ• ์ง€๋ฅผ ์ „๋‹ฌํ•ฉ๋‹ˆ๋‹ค.
    banner = new OAMBanner( MyActivity.this, Gravity.TOP|Gravity.CENTER );
    ...
}

Set the banner PLACEMENT ID.

The banner PLACEMENT ID can be created in the ONE AdMax console.

banner.setPlacementId( PLACEMENT_ID );

Banner Size

There are three banner size options, and the value specified when creating the banner ad in the ONE AdMax console must be set accordingly.

public enum Size {
    BANNER_320x50, BANNER_300x250, BANNER_320x100,
}
 
banner.setSize( OAMBanner.Size.BANNER_320x50 );

Banner refresh interval

The configurable range is 15 to 300 seconds, and setting it to -1 disables the refresh.

banner.setRefreshTime( 60 ); // default 60 sec

Banner network schedule timeout setting

When loading banner ads, a timeout is set for each network (mediation partner). If an ad is not received within the specified time, it moves on to the next network.

banner.setNetworkScheduleTimeout( 5 ); // default 5 sec

Banner animation settings

public enum AnimType{
    NONE,          
    FADE_IN,       
    SLIDE_LEFT,    
    SLIDE_RIGHT,
    TOP_SLIDE,
    BOTTOM_SLIDE,
    CIRCLE,
}
 
banner.setAnimType( OAMBanner.AnimType.FADE_IN ); // default : NONE

Banner background color settings

You can fill the empty space in the view where the banner ad appears with an optimized background color that matches the ad.

banner.setAutoBgColor( true );  // default true

Banner request

The load() API is called at the desired point when the banner should appear on the screen. Once the loading is complete, the onLoaded() event is triggered, and the banner will automatically appear on the screen.

banner.load();

Excessive calls to the load() API will result in a block.

Banner interruption

This is called when you want to stop the banner ad. Typically, it is called when the activity or fragment displaying the banner is destroyed.

banner.stop();

Calling stop() when entering the onPause state may lead to missing click report data. Therefore, it is recommended to call it when the activity or fragment containing the banner view is destroyed.

Banner visibility status

Unlike other ad types, banners are automatically displayed on the screen once they are loaded. Therefore, you can use the following API to determine whether the banner is visible or not.

banner.isLoaded();

Banner event listener

Set up listeners for events that occur when loading a banner. The provided listeners and implementation examples are as follows:

banner.setEventListener( new IOAMBannerEventListener(){
    @Override
    public void onLoaded(){                     // banner loading ์„ฑ๊ณต
        Log.d( Tag, "onBannerAdLoaded" );
    }
 
    @Override
    public void onLoadFailed( OAMError error ){ // banner loading ์‹คํŒจ
        Log.d( Tag, "onLoadFailed : " + error.toString() );
    }
     
    @Override
    public void onClicked(){                    // banner click.
        Log.d( Tag, "onBannerAdLoaded" );
    }
});

Banner onPause / onResume

In the onPause / onResume of the Activity or Fragment where the banner ad is displayed, you should call the banner's onPause / onResume. If onPause / onResume is not handled correctly, there may be missing report data when using third-party mediation. Therefore, it is recommended to implement it as shown below.

OAMBanner   banner;
 
public void onPause(){
    super.onPause();
 
    if( banner != null )
        banner.onPause();
}
 
public void onResume(){
    super.onResume();
 
    if( banner != null )
        banner.onResume();
}

Banner Mediation

Banner ads support the use of some mediation platforms. The settings must be configured before calling the banner's load() API.

HashMap map = new HashMap<>();
map.put( OAMBanner.MediationExtra.CAULY_USE_DYNAMIC_RELOAD, false );
map.put( OAMBanner.MediationExtra.CAULY_RELOAD_INTERVAL, 20 );
map.put( OAMBanner.MediationExtra.CAULY_THREAD_PRIORITY, 5 );
 
banner.setMediationExtras( map );
banner.load();

The configuration values for supported mediations are as follows:

CAULY_ENABLE_LOCK               : ์ž ๊ธˆ ํ™”๋ฉด์—์„œ ๋…ธ์ถœ ๊ฐ€๋Šฅ ์—ฌ๋ถ€. default false.
CAULY_ENABLE_DYNAMIC_RELOAD_INTERVAL: ์นด์šธ๋ฆฌ ๋‹ค์ด๋‚˜๋ฏน ๋ฐฐ๋„ˆ ๊ฐฑ์‹  ์‚ฌ์šฉ ์—ฌ๋ถ€. default true.
CAULY_RELOAD_INTERVAL           : ์นด์šธ๋ฆฌ ๋ฐฐ๋„ˆ ๊ฐฑ์‹  ์ฃผ๊ธฐ. range: 10~120. default 20s. CAULY_ENABLE_DYNAMIC_RELOAD_INTERVAL๋ฅผ false๋กœ ์„ค์ •ํ›„์— ์‚ฌ์šฉ๊ฐ€๋Šฅ.
CAULY_THREAD_PRIORITY           : ์นด์šธ๋ฆฌ ์Šค๋ ˆ๋“œ ์šฐ์„  ์ˆœ์œ„ ์ง€์ •. range: 1~10. default 5.
 
MEZZO_AGE_LEVEL                 : ์œ ์ € ๋‚˜์ด ์ •๋ณด, default -1. ์•Œ์ˆ˜ ์—†์Œ = -1, ์–ด๋ฆฐ์ด(13์„ธ ๋ฏธ๋งŒ) = 0, ์ฒญ์†Œ๋…„ ๋ฐ ์„ฑ์ธ(๋งŒ 13์„ธ ์ด์ƒ) = 1
MEZZO_ENABLE_BACKGROUND_CHECK   : ๋ฐฑ๊ทธ๋ผ์šด๋“œ ๊ฐฑ์‹  ์‚ฌ์šฉ ์—ฌ๋ถ€.
MEZZO_STORE_URL                 : ์•ฑ ์Šคํ† ์–ด URL

Banner sample code

private OAMBanner banner;
 
@Override
protected void onCreate( Bundle savedInstanceState ){
    super.onCreate( savedInstanceState );
    ...
     
    // ONEAdMax ๋กœ๊ทธ ํ™œ์„ฑํ™”. apk release์‹œ์—๋Š” ์‚ญ์ œํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
    ONEAdMax.setLogEnable( true );
 
    //ONEAdMax SDK ์ดˆ๊ธฐํ™”
    if( ONEAdMax.isInit( MyActivity.this ) == false ){
        ONEAdMax.init( MyActivity.this, new IOAMInitListener() {
            @Override
            public void onInitialized() {
                Log.d( Tag, "ONEAdMax SDK Initialized.");
                initBanner( yourBannerPlacementID,  youtBannerSize  );
            }
        });
    }
 
    ...
}
 
 
public void initBanner( String placementId, OAMBanner.Size bannerSize ){
    // xml ์—†์ด ์ฝ”๋“œ๋กœ Banner ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
    banner = new OAMBanner( MyActivity.this, Gravity.TOP|Gravity.CENTER );
 
    // placementID์™€ size setting์€ ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค.  
    banner.setPlacementId( yourBannerPlacementID );
    banner.setSize( bannerSize );
 
    // optional    
    banner.setAnimType( OAMBanner.AnimType.FADE_IN );
    banner.setAutoBgColor( true );    
    banner.setNetworkScheduleTimeout( 10 );
    banner.setRefreshTime( 15 );
   
    HashMap map = new HashMap<>();
    map.put( OAMBanner.MediationExtra.CAULY_USE_DYNAMIC_RELOAD, false );
    map.put( OAMBanner.MediationExtra.CAULY_RELOAD_INTERVAL, 20 );
    map.put( OAMBanner.MediationExtra.CAULY_THREAD_PRIORITY, 5 );
    banner.setMediationExtras( map ); 
 
 
    // listener๋ฅผ ๋“ฑ๋กํ•˜์ง€ ์•Š์œผ๋ฉด ์ด๋ฒคํŠธ๋ฅผ ๋ฐ›์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.
    banner.setEventListener( new IOAMBannerEventListener(){
        @Override
        public void onLoaded(){
            Log.d( Tag, "banner load success" );
        }
 
        @Override
        public void onLoadFailed( OAMError error ){
            Log.d( Tag, "banner load failed: " + error.toString() );
        }
 
        @Override
        public void onClicked(){
            Log.d( Tag, "banner clicked." );
        }
    } );    
 
    banner.load();
}
 
@Override
public void onPause(){
    super.onPause();
 
    if( banner != null )
        banner.onPause();
}
 
@Override
public void onResume(){
    super.onResume();
 
    if( banner != null )
         banner.onResume();
}
 
@Override
protected void onDestroy(){
    super.onDestroy();  
     
    if( banner != null )
        banner.stop();
 
    ONEAdMax.unInit();
}
Previous3-2. Interstitial AdsNext3-4. Interstitial Video Ads (Non Reward)

Last updated 4 months ago

ONE AdMax SDK Error Codes