This repository has been archived by the owner on Apr 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Fullscreen ads
fan-c-yu edited this page Mar 5, 2021
·
5 revisions
If you have not created ad spaces or downloaded SDK, please refer to the link below.
If you have not imported Unity package into project, please follow the link below.
- Get an instance of
NendAdFullBoard
withNewFullBoardAd
method ofNendAdFullBoard
. - Optionally register the call back of the event you want to handle.
The events are as follows.public event NendAdFullBoardLoaded AdLoaded; public event NendAdFullBoardFailedToLoad AdFailedToLoad; public event NendAdFullBoardShown AdShown; public event NendAdFullBoardClick AdClicked; public event NendAdFullBoardDismiss AdDismissed;
- Load the ad with
Load
method ofNendAdFullBoard
.
Error code at load failure is as follows.public enum FullBoardAdErrorType : int { FailedAdRequest, // Ad request failed InvalidAdSpaces, // Unavailable ad spaces. FailedDownloadImage // Failed to download ad image. }
- Display the ad with
Show
method ofNendAdFullBoard
.
Note: When you close the fullscreen ads, the ad is not automatically reloaded. When updating the advertisement contents, you need to execute the loading process again.
using UnityEngine;
using NendUnityPlugin.AD.FullBoard;
public class FullBoardObject : MonoBehaviour
{
private NendAdFullBoard m_fullBoardAd;
// Use this for initialization
void Start ()
{
m_fullBoardAd = NendAdFullBoard.NewFullBoardAd (spotId, "apiKey");
m_fullBoardAd.AdLoaded += (NendAdFullBoard instance) => {
// Success
};
m_fullBoardAd.AdFailedToLoad += (NendAdFullBoard instance, NendAdFullBoard.FullBoardAdErrorType type) => {
// Failure
};
m_fullBoardAd.AdShown += (NendAdFullBoard instance) => {
// Display
};
m_fullBoardAd.AdClicked += (NendAdFullBoard instance) => {
// Click
};
m_fullBoardAd.AdDismissed += (NendAdFullBoard instance) => {
// Dismiss
};
}
public void Load ()
{
// Load the ad
m_fullBoardAd.Load ();
}
public void Show ()
{
// Display the ad
m_fullBoardAd.Show ();
}
}
You can change the background color outside iPhoneX Safe Area
more affinitive to your app looking & feeling.
m_fullBoardAd.AdLoaded += (NendAdFullBoard instance) => {
// Success
instance.IOSBackgroundColor = Color.white;
};
For more information, please check iOS wiki "About background color outside Safe Area".