【问题标题】:Unity: I don't receive an AdMob banner or interstitialUnity:我没有收到 AdMob 横幅或插页式广告
【发布时间】:2019-04-05 13:49:11
【问题描述】:

当我使用 Unity 构建我的应用程序时,一切正常。 我收到了这样的消息:

虚拟负载广告

但是当我在我的设备中发布我的构建时,我没有收到任何广告。 我在 Play Store 上发布了我的应用程序,并在多台设备上进行了测试,但没有结果。

我的统一版本是2018.3.3f1。并且代码在 AdMob 函数中被阻止。

这是我的代码:

//request a banner
public void RequestBanner()
  {
    // These ad units are configured to always serve test ads.
#if UNITY_EDITOR
    string adUnitId = "unused";
#elif UNITY_ANDROID
    string adUnitId = "ca-app-pub-2202385704427937/3307508552";
#elif UNITY_IPHONE
    string adUnitId = "ca-app-pub-3940256099942544/2934735716";
#else
    string adUnitId = "unexpected_platform";
#endif

    // Clean up banner ad before creating a new one.
    if (this.bannerView != null)
    {
        this.bannerView.Destroy();
    }

    // Create a 320x50 banner at the top of the screen.
    this.bannerView = new BannerView(adUnitId, AdSize.SmartBanner, 
 AdPosition.Top);

    // Register for ad events.
    this.bannerView.OnAdLoaded += this.HandleAdLoaded;
    this.bannerView.OnAdFailedToLoad += this.HandleAdFailedToLoad;
    this.bannerView.OnAdOpening += this.HandleAdOpened;
    this.bannerView.OnAdClosed += this.HandleAdClosed;
    this.bannerView.OnAdLeavingApplication += 
    this.HandleAdLeftApplication;

    // Load a banner ad.
    this.bannerView.LoadAd(this.CreateAdRequest());
}


//request a interstitial video
public void RequestInterstitial()
  {
    // These ad units are configured to always serve test ads.
#if UNITY_EDITOR
    string adUnitId = "unused";
#elif UNITY_ANDROID
    string adUnitId = "ca-app-pub-2202385704427937/1308031170";
#elif UNITY_IPHONE
    string adUnitId = "ca-app-pub-3940256099942544/4411468910";
#else
    string adUnitId = "unexpected_platform";
#endif

    // Clean up interstitial ad before creating a new one.
    if (this.interstitial != null)
    {
        this.interstitial.Destroy();
    }

    // Create an interstitial.
    this.interstitial = new InterstitialAd(adUnitId);

    // Register for ad events.
    this.interstitial.OnAdLoaded += this.HandleInterstitialLoaded;
    this.interstitial.OnAdFailedToLoad += 
    this.HandleInterstitialFailedToLoad;
    this.interstitial.OnAdOpening += this.HandleInterstitialOpened;
    this.interstitial.OnAdClosed += this.HandleInterstitialClosed;
    this.interstitial.OnAdLeavingApplication += 
    this.HandleInterstitialLeftApplication;

    // Load an interstitial ad.
    this.interstitial.LoadAd(this.CreateAdRequest());
}


 //to show video
public void ShowInterstitial()
  {
    if (this.interstitial.IsLoaded())
    {
        this.interstitial.Show();
    }
    else
    {
        MonoBehaviour.print("Interstitial is not ready yet");
    }
  }

【问题讨论】:

    标签: unity3d


    【解决方案1】:

    不幸的是,我没有 50 分可以将此作为对您的 OP 的评论。可能是duplicate,但是嘿,如果您的测试广告一切正常,那么您可能忘记添加实时广告的付款详细信息。

    【讨论】:

    • 当我尝试旧的 admob 插件测试时,广告效果很好,但真正的广告没有。
    • 现在我尝试了一个 2018 年的插件,我既没有收到测试也没有收到真正的广告
    【解决方案2】:

    我解决了我的问题。 我将这些行添加到 android manifest

            <meta-data
            android:name="com.Company.laytonMiniGames"
            android:value="ca-app-pub- 
            2202385704427937~1064488595"/>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-06-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-04
      • 2013-10-23
      • 1970-01-01
      相关资源
      最近更新 更多