🗂️
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
  • Before you begin
  • ONEAdMax SDK initialize
  • Interstitial Video Ads sample code
  • Create an instance of the OAMInterstitialVideo ad.
  • Set the network schedule timeout (optional)
  • Set the event listener for Interstitial Video Ads (optional)
  • Create an instance of the Interstitial Video Ad
  • Load the Interstitial Video Ad.
  • Display the Interstitial Video Ad.
  • Destroy the memory for the Interstitial Video Ad.
  • Check whether the Interstitial Video Ad is loaded
  1. 04. Unity-Plugin Guide

4-4. Interstitial Video Ads for Unity (Non Reward)

It is the same format as video ads, but it is a type of ad that does not provide rewards.

Previous4-3. Banner Ads for UnityNext05. Flutter-Plugin Guide

Last updated 4 months ago

Before you begin

ONEAdMax SDK initialize

Initialization of ONEAdMax is required before loading ads. ONEAdMaxClient.Initialize() should only be executed once during the initial setup.

...
using ONEAdMax;
...
public class ONEAdMaxDemo : MonoBehaviour
{
    private static bool _isInitialized = false;
    
    void Start()
    {
        if (!_isInitialized)
        {
            // Initialize the ONEAdMax SDK.
            ONEAdMaxClient.Initialize(() =>
            {
                // This callback is called once the ONEAdMax SDK is initialized.
                _isInitialized = true
            });
        }
    }
}

Interstitial Video Ads sample code

You can create an instance of OAMInterstitialVideo and handle events to extend its functionality.

Create an instance of the OAMInterstitialVideo ad.

public class InterstitialVideoAdController : MonoBehaviour
{
    OAMInterstitialVideo _interstitialVideoAd;
    
    /// <summary>
    /// Creates the ad.
    /// </summary>
    public void CreateInterstitialVideoAd()
    {
        Debug.Log("Creating Interstitial video ad.");
        
        if (_interstitialVideoAd != null)
        {
            Debug.LogWarning("Already have a Interstitial video ad.");
            return;
        }

        _interstitialVideoAd = new OAMInterstitialVideo();
    }
}

Set the network schedule timeout (optional)

광고에 대한 네트워크 스케쥴 타임아웃을 설정합니다. (기본값: 5초) 광고 로딩 시 각 네트워크 별로 타임아웃 시간을 주어 해당 시간 안에 광고를 받지 못할 경우, 다음 네트워크로 넘어갑니다.

_interstitialVideoAd.SetNetworkScheduleTimeout(5); // Default 5 seconds

Set the event listener for Interstitial Video Ads (optional)

/// <summary>
/// Register to events the interstital video ad may raise.
/// </summary>
private void RegisterEvents(OAMInterstitialVideo ad)
{
    // Raised when an ad is loaded into the interstitial ad.
    ad.OnLoaded += () =>
    {
        Debug.Log("Interstitial video ad loaded.");
    };

    // Raised when an ad fails to load into the interstitial ad.
    ad.OnLoadFailed += (OAMError error) =>
    {
        Debug.LogError("Interstitial video ad failed to load an ad with error : " + error);
    };

    // Raised when an ad opened full screen content.
    ad.OnOpened += () =>
    {
        Debug.Log("Interstitial video ad has been opened.");
    };

    // Raised when the ad failed to open full screen content.
    ad.OnOpenFailed += (OAMError error) =>
    {
        Debug.LogError("Interstitial video ad failed to open an ad with error : " + error);
    };

    // Raised when the ad closed full screen content.
    ad.OnClosed += () =>
    {
        Debug.LogError("Interstitial video ad is closed.");
    };
}

Create an instance of the Interstitial Video Ad

Complete all the settings and create the OAMInterstitialVideo.

// These ad units are configured to always serve test ads.   
private readonly string _placementId = "string your placementID";

_interstitialVideoAd.Create(_placementId);

Load the Interstitial Video Ad.

전면 비디오 광고 Load() API를 호출하여 서버에 광고를 요청합니다.

/// <summary>
/// Loads the ad.
/// </summary>
public void Load()
{
    if (_interstitialVideoAd == null)
    {
        Debug.LogWarning("The interstital video ad is null.");
        return;
    }

    _interstitialVideoAd.Load();
}

Excessive ad requests can lead to blocking, so please be cautious!

Display the Interstitial Video Ad.

로드가 완료되면 광고를 노출을 원하는 시점에 Show() API를 호출하여 화면에 노출 시킵니다.

/// <summary>
/// Shows the ad.
/// </summary>
public void Show()
{
    if (_interstitialVideoAd != null && _interstitialVideoAd.IsLoaded())
    {
        Debug.Log("Showing interstital video ad.");
        _interstitialVideoAd.Show();
    }
    else
    {
        Debug.LogError("The Interstitial video ad hasn't loaded yet.");
    }
}

Destroy the memory for the Interstitial Video Ad.

/// <summary>
/// Destroys the ad.
/// </summary>
public void Destroy()
{
    if (_interstitialVideoAd != null)
    {
        Debug.Log("Destroying interstitial video ad.");
        _interstitialVideoAd.Destroy();
        _interstitialVideoAd = null;
    }
}

Check whether the Interstitial Video Ad is loaded

Check whether the Interstitial Video Ad is loaded. (returns true | false)

_interstitialVideoAd.IsLoaded();
04. Unity-Plugin Guide
ONE AdMax SDK Error Codes