我的AdMob横幅未显示 [英] My AdMob banner is not showing

查看:151
本文介绍了我的AdMob横幅未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我有LibGDX应用,并且正在添加这样的横幅:

So, I have LibGDX app and I'm adding banner like this:

public class AndroidLauncher extends AndroidApplication {
    @Override
    protected void onCreate (Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Create the layout
        RelativeLayout layout = new RelativeLayout(this);
        // Do the stuff that initialize() would do for you
        requestWindowFeature(Window.FEATURE_NO_TITLE);

        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);

        // Create the libgdx View
        AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
        View gameView = initializeForView(new Soldiers(), config);

        // Create and setup the AdMob view
        AdView adView = new AdView(this); // Put in your secret key here
        adView.setAdSize(AdSize.SMART_BANNER);
//      adView.setAdUnitId("ca-app-pub-3940256099942544/6300978111"); // dummy banner
        adView.setAdUnitId("MY_AD_ID"); // Mine


        // Create an ad request.
        AdRequest.Builder adRequestBuilder = new AdRequest.Builder();

        layout.addView(gameView);

        // Add the AdMob view
        RelativeLayout.LayoutParams adParams =
                new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
                        RelativeLayout.LayoutParams.WRAP_CONTENT);
        adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        adParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);

        layout.addView(adView, adParams);
        adView.loadAd(adRequestBuilder.build());

        setContentView(layout);

    }

我当然要放置我的真实横幅ID而不是"MY_AD_ID".然后清单文件中的横幅广告活动如下:

Instead of "MY_AD_ID" I'm placing my real banner id of course. Then my banner activity in manifest file looks like:

<activity
    android:name="com.google.android.gms.ads.AdActivity"
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
    android:theme="@android:style/Theme.Translucent" />

如果我使用的是虚拟横幅ID,则显示效果很好.我在屏幕底部看到一个小横幅,上面写着:"AdMob测试智能横幅...",第二个(如果我滑动的话)说:您已经从AdMob加载了一个测试广告.要走的路!"第三个是"developers.google.com/admob".所以看来我做得对.但是,只要我将虚拟横幅ID更改为真实的横幅,就会立即显示出来吗?!

And if I'm using that dummy banner id it shows well. I see small banner at the bottom of the screen saying: "AdMob Test Smart Banner ..." and second one (if I slide it) saying "You've loaded a test ad from AdMob. Way to go!" and third one "developers.google.com/admob". So it seems that I'm doing it right. But as soon as I change dummy banner id with real one banner is just now showing up?!

我正在真实设备(Nexus 5)上进行测试,并且正在使用Android Studio.

I'm testing on real device (Nexus 5) and working with Android studio.

在我的横幅广告的AdMob页面上,它有10个网络请求,但有0个匹配请求,匹配率当然是0%.

On AdMob page for my banner says it has 10 network requests but 0 matched requests and matching rate of 0% of course.

我的应用发布在Play商店上,并且我将广告链接到该应用.

My app is published on play store and I linked my ad with that app.

我做错了什么?由于虚拟人正在工作,我会说真实的横幅设置有问题,但是那又是什么呢?我如何找出问题所在?

What I'm doing wrong? Since dummy one is working I would say something is wrong with the real banner settings, but what? How can I find out what the problem is?

推荐答案

因此,首先10个请求中的0个广告并不那么具有代表性,特别是如果所有这些广告都来自同一地区(例如同一国家/地区).

So first of all 0 ads of 10 request is not so representative especially if all of them comes from the same region (like same country).

如果AdMob可以处理测试广告,则可以实施.如果由于缺少广告而导致请求/匹配率较低,则可以使用多个广告网络.

If AdMob is working with test ad, the implementation should be fine. If the low request / match caused by the lack of ads you can use multiple ad networks.

对于新的AdMob帐户,可能还需要一些时间来投放第一个广告.

Also for fresh AdMob accounts it may take some time to delivery the first ad.

这篇关于我的AdMob横幅未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆