「Unity/GoogleMobileAds/Interstitial」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「==admobのInterstitalとは== 全画面広告で、閉じるボタンが付いた広告。閉じるボタンは広告によって位置はまちまち。 ==admob公式==...」) |
(相違点なし)
|
2019年5月29日 (水) 18:51時点における版
admobのInterstitalとは
全画面広告で、閉じるボタンが付いた広告。閉じるボタンは広告によって位置はまちまち。
admob公式
https://developers.google.com/admob/unity/interstitial?hl=ja
サンプル
using GoogleMobileAds.Api; private InterstitialAd interstitial; private void RequestInterstitial() { #if UNITY_ANDROID string adUnitId = "ca-app-pub-3940256099942544/1033173712"; #elif UNITY_IPHONE string adUnitId = "ca-app-pub-3940256099942544/4411468910"; #else string adUnitId = "unexpected_platform"; #endif interstitial = new InterstitialAd(adUnitId); // Called when an ad request has successfully loaded. interstitial.OnAdLoaded += HandleOnAdLoaded; // Called when an ad request failed to load. interstitial.OnAdFailedToLoad += HandleOnAdFailedToLoad; // Called when an ad is shown. interstitial.OnAdOpening += HandleOnAdOpened; // Called when the ad is closed. interstitial.OnAdClosed += HandleOnAdClosed; // Called when the ad click caused the user to leave the application. interstitial.OnAdLeavingApplication += HandleOnAdLeavingApplication; AdRequest request = new AdRequest.Builder() .AddTestDevice("F5E9973E1BED6D5E3F9xxxxxx") .Build(); interstitial.LoadAd(request); } void ShowAd() { if (interstitial.IsLoaded()) { interstitial.Show(); } }