IronSource との連携
1. 概要
IronSource のインタースティシャル広告やリワード広告と AdMel SDK を併用する場合、広告の表示・終了時に AdMel の音声広告の状態を適切に制御する必要があります。
2. IronSource の広告表示時の処理
広告が表示される際に、AdMel のオートリフレッシュを停止し、音声広告を停止します。
using IronSourceSDK;
// インタースティシャル広告が表示された際の処理
void OnInterstitialAdShow()
{
AdMelSdk.DisableAutoRefresh();
AdMelSdk.StopAd();
}
// リワード広告が表示された際の処理
void OnRewardedAdShow()
{
AdMelSdk.DisableAutoRefresh();
AdMelSdk.StopAd();
}
// IronSource のイベントリスナー登録
IronSourceEvents.onInterstitialAdOpenedEvent += OnInterstitialAdShow;
IronSourceEvents.onRewardedVideoAdOpenedEvent += OnRewardedAdShow;3. IronSource の広告終了時の処理
広告が閉じられた後に、AdMel のオートリフレッシュを再開します。
// インタースティシャル広告が閉じられた際の処理
void OnInterstitialAdClosed()
{
AdMelSdk.EnableAutoRefresh();
}
// リワード広告が閉じられた際の処理
void OnRewardedAdClosed()
{
AdMelSdk.EnableAutoRefresh();
}
// IronSource のイベントリスナー登録
IronSourceEvents.onInterstitialAdClosedEvent += OnInterstitialAdClosed;
IronSourceEvents.onRewardedVideoAdClosedEvent += OnRewardedAdClosed;4. AdMel SDK の広告再生中にインタースティシャルをスキップ
また、AdMel SDK の音声広告が流れている間は、インタースティシャル広告をスキップするかどうかはパブリッシャー様の制御 となります。
void TryShowInterstitial()
{
if (!AdMelSdk.IsAdShowing())
{
// show interstitial ad
}
else
{
Debug.Log("AdMelの音声広告が再生中のため、インタースティシャルをスキップ");
}
}5. まとめ
| 状況 | 処理 |
|---|---|
| IronSource の広告が開始 | AdMelSdk.DisableAutoRefresh();
AdMelSdk.StopAd(); |
| IronSource の広告が終了 | AdMelSdk.EnableAutoRefresh(); |