03. SDK for Java 3-4. Interstitial Video Ads (Non Reward) It is an ad type that is similar to video ads but does not offer rewards.
Create an Interstitial Video Ads instance
Copy private OAMInterstitialVideo interstitialVideo;
@Override
protected void onCreate(Bundle savedInstanceState) {
...
interstitialVideo = new OAMInterstitialVideo( this );
}
Interstitial Video Ads PLACEMENT ID
Add the following code to set the PLACEMENT ID for the Interstitial Video Ads. The PLACEMENT ID for Interstitial Video Ads can be generated in the ONE AdMax console.
Copy interstitialVideo.setPlacementId( PLACEMENT_ID );
Interstitial Video Ads network schedule timeout
When loading Interstitial Video Ads, a timeout is set for each network (mediation partner). If an ad is not received within the specified time, it will move on to the next network.
Copy interstitialVideo.setNetworkScheduleTimeout( 10 ); // default 10 sec
Interstitial Video Ads request
Copy interstitialVideo.load();
Excessive calls to the load()
API will result in a block.
Interstitial Video Ads display
Copy interstitialVideo.show();
Specify the Activity for displaying Interstitial Video Ads
This is used when displaying Interstitial Video Ads in an activity different from the one where the load()
API was called.
Copy interstitialVideo.setCurrentActivity( activity );
Check if the Interstitial Video Ads have been loaded
This is called to check whether the Interstitial Video Ads have been loaded or not.
Copy interstitialVideo.isLoaded();
Interstitial Video Ads event listener
Set up listeners for events that occur when loading Interstitial Video Ads.
Copy interstitalVideo.setEventListener( new IOAMInterstitialVideoEventListener(){
@Override
public void onLoaded(){ // ์ ๋ฉด ๋น๋์ค ๊ด๊ณ loading ์ฑ๊ณต
Log.d( Tag, "interstitalVideo load success" );
}
@Override
public void onLoadFailed( OAMError error ){ // ์ ๋ฉด ๋น๋์ค ๊ด๊ณ loading ์คํจ
Log.d( Tag, "interstitalVideo load failed " + error.toString() );
}
@Override
public void onOpened(){ // ์ ๋ฉด ๋น๋์ค ๊ด๊ณ open ์ฑ๊ณต
Log.d( Tag, "interstitalVideo open success" );
}
@Override
public void onOpenFailed( OAMError error ){ // ์ ๋ฉด ๋น๋์ค ๊ด๊ณ open ์คํจ
Log.d( Tag, "interstitalVideo open failed " + error.toString() );
}
@Override
public void onClosed(){ // ์ ๋ฉด ๋น๋์ค ๊ด๊ณ ์ข
๋ฃ
Log.d( Tag, "interstitalVideo closed " + event );
}
@Override
public void onClicked(){ // ์ ๋ฉด ๋น๋์ค ๊ด๊ณ ํด๋ฆญ. ์ผ๋ถ ๋ฏธ๋์์ด์
๊ด๊ณ ๋ ์ง์ ์ํจ
Log.d( Tag, "interstitalVideo clicked" );
}
} );
Interstitial Video Ad Sample Code
Copy private OAMInterstitalVideo interstitialVideo;
@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.");
initInterstitialVideo( yourInterstitialViceoPlacementID );
}
});
}
...
}
public void initInterstitialVideo( String youtPlacementId ){
interstitialVideo = new OAMInterstitalVideo( this );
// placementID๋ ํ์์
๋๋ค.
interstitialVideo.setPlacementId( youtPlacementId );
// optional
interstitialVideo.setNetworkScheduleTimeout( 10 );
// listener๋ฅผ ๋ฑ๋กํ์ง ์์ผ๋ฉด ์ด๋ฒคํธ๋ฅผ ๋ฐ์ ์ ์์ต๋๋ค.
interstitialVideo.setEventListener( new IOAMInterstitialVideoEventListener(){
@Override
public void onLoaded(){ // ์ ๋ฉด ๋น๋์ค ๊ด๊ณ loading ์ฑ๊ณต
Log.d( Tag, "interstitalVideo load success" );
// loading ์ฑ๊ณต ์ดํ, showing.
interstitialVideo.show();
}
@Override
public void onLoadFailed( OAMError error ){ // ์ ๋ฉด ๋น๋์ค ๊ด๊ณ loading ์คํจ
Log.d( Tag, "interstitalVideo load failed " + error.toString() );
}
@Override
public void onOpened(){ // ์ ๋ฉด ๋น๋์ค ๊ด๊ณ open ์ฑ๊ณต
Log.d( Tag, "interstitalVideo open success" );
}
@Override
public void onOpenFailed( OAMError error ){ // ์ ๋ฉด ๋น๋์ค ๊ด๊ณ open ์คํจ
Log.d( Tag, "interstitalVideo open failed " + error.toString() );
}
@Override
public void onClosed(){ // ์ ๋ฉด ๋น๋์ค ๊ด๊ณ ์ข
๋ฃ
Log.d( Tag, "interstitalVideo closed " + event );
}
@Override
public void onClicked(){ // ์ ๋ฉด ๋น๋์ค ๊ด๊ณ ํด๋ฆญ
Log.d( Tag, "interstitalVideo clicked" );
}
} );
interstitalVideo.load();
}
@Override
protected void onDestroy(){
super.onDestroy();
ONEAdMax.unInit();
}
Last updated 4 months ago