我有我的谷歌横幅广告脚本和谷歌移动广告插件,但出于某种原因,我发布后广告没有在应用程序中显示
使用测试ID时,我们会在测试时使用它们
using GoogleMobileAds.Api;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AdScript : MonoBehaviour {
// Use this for initialization
void Start () {
showBannerAd();
}
private void showBannerAd()
{
string adID = "ca-app-pub-4076551740851810/4176317920";
//ca-app-pub-3940256099942544/6300978111 FOR TESTING
//***For Testing in the Device***
//AdRequest request = new AdRequest.Builder()
// Simulator.
//.AddTestDevice("1e84e34350774f47") // My test device.
//.Build();
//***For Production When Submit App***
AdRequest request = new AdRequest.Builder().Build();
BannerView bannerAd = new BannerView(adID, AdSize.SmartBanner, AdPosition.Bottom);
bannerAd.LoadAd(request);
}
// Update is called once per frame
void Update () {
}
}
我已经在admob上注册了它们并将它链接到我的谷歌我相信我将提供屏幕截图并在需要时提供其他信息
答案 0 :(得分:0)
通过包含以下代码,您的布局是否具有正确的设置?
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-4076551740851810/4176317920">
</com.google.android.gms.ads.AdView>