测试了AdMob的工作之前发布测试、工作、AdMob

2023-09-09 21:59:21 作者:十里温柔

现在很喜欢,我fishished一个机器人项目,并建立了所有认为你需要做的CREAE AdMob的广告。遗憾的是不模拟器(对我来说)显示广告,eather做我的手机了。所以,我该怎么做,看看我的AdMob的实际工作?

Now it is like that I have fishished an android project and have set up all the thinks you need to do to creae admob ads. Unfortunately does not the emulator(for me) shows ads, eather do my cellphone that. So how do I do to see if my admob actually works?

code:

    admobView = new AdView(this, AdSize.BANNER, "Top secret");
    RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT,
            RelativeLayout.LayoutParams.WRAP_CONTENT);
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    admobView.setLayoutParams(lp);

    RelativeLayout layout = new RelativeLayout(this);
    layout.addView(renderView);
    layout.addView(admobView);
    admobView.loadAd(new AdRequest());
    setContentView(layout);

该应用程序工作正常(的RenderView),但我不知道是否确实AD浏览。是的,在AdMob的ID是对的。

The app works fine(renderView) but I have no idea if adView does. And yes, the admob ID is right.

推荐答案

您可以在模拟器上测试的AdMob也。你需要测试模式,以实现这一目标。参见教程步骤6的更多信息:如何Admob的集成到您的应用

You can test AdMob in emulator also. You need the test mode to achieve that. See tutorial Step 6 for more info: How to integrate Admob into your app

如果你没有找到设备ID LogCat中,你也可以尝试添加TEST_EMULATOR恒:

If you don't find the device ID in LogCat you can also try to add the TEST_EMULATOR constant:

request.addTestDevice(AdRequest.DEVICE_ID_EMULATOR);