私は基本的にこのGoogleモバイル広告の公式支店で設定したデモプロジェクト広告をコピー&ペーストして軽く修正しました。バナー広告はすべて表示されますが、インタースティシャル広告は表示されませんどのような。ここでAdmobインタースティシャル広告がまったく表示されない
は私AdManager static class
を使用して、私がやったことだ:
このInitializeAds()
は、右のゲームを開始した後に呼び出されます。
public static void InitializeAds()
{
MobileAds.Initialize(appID);
}
そしてもちろん、広告があるすべてのレベルは、以下のGetSomeAdRequests()
を持っていますその中にはStart()
メソッドがあります。
public static void GetSomeAdRequests()
{
AdRequestBANNER = CreateAdRequest();
AdRequestINTERST = CreateAdRequest();
}
public static AdRequest CreateAdRequest()
{
AdRequest request = new AdRequest.Builder().Build();
return request;
}
Googleが提供するテスターのビデオとバナーIDを使用します。
次に、私のRequestInterstitial
:
public static void RequestInterstitial()
{
// These ad units are configured to always serve test ads.
#if UNITY_EDITOR
string adUnitId = "unused";
#elif UNITY_ANDROID
string adUnitId = videoID;
#else
string adUnitId = "unexpected_platform";
#endif
// Clean up interstitial ad before creating a new one.
if (interstitial != null)
{
interstitial.Destroy();
}
// Create an interstitial.
interstitial = new InterstitialAd(adUnitId);
// Register for ad events.
interstitial.OnAdLoaded += HandleInterstitialLoaded;
interstitial.OnAdFailedToLoad += HandleInterstitialFailedToLoad;
interstitial.OnAdOpening += HandleInterstitialOpened;
interstitial.OnAdClosed += HandleInterstitialClosed;
interstitial.OnAdLeavingApplication += HandleInterstitialLeftApplication;
// Load an interstitial ad.
interstitial.LoadAd(AdRequestINTERST);
if (interstitial.IsLoaded())
{
interstitial.Show();
}
}
そして最後にAdRequestINTERST
は次のとおりです。
private static AdRequest adRequestINTERST;
public static AdRequest AdRequestINTERST
{
get
{
if (adRequestINTERST == null)
{
adRequestINTERST = CreateAdRequest();
}
return adRequestINTERST;
}
set
{
adRequestINTERST = value;
}
}
はrequest
が決して nullであることを確認するためにこの方法を実装しました。
今、私はvidの初期化に多くの時間を割いていますが、それは最初の起動時に負荷がかかるはずですが、それでも何もしません。エラーもフリーズもありません。
エディタでは、Debug.Log
を使用してテストしましたが、実際に広告を呼び出すコードに到達しました。バナー広告は正常に動作しますが、表示されません。
アイデア?
上記のコードスニペットで広告を表示するためのコードが表示されません。 if(インタースティシャル.IsLoaded()){ interstitial.Show(); } – ZayedUpal
それは良いヒントでしたが、それでも運はありません:/それにもかかわらず質問を編集します。 – agiro