开发者

android admob sdk error

开发者 https://www.devze.com 2023-02-18 03:05 出处:网络
I\'ve tried to make a test app to see how admob works. But almost every time \"No ad to show\". Here is my source code:

I've tried to make a test app to see how admob works. But almost every time "No ad to show". Here is my source code:

public voi开发者_开发技巧d onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    AdView adView = new AdView(this, AdSize.BANNER, "xxxxxxxxxxxxxxxxx");
    adView.setAdListener(this);
    LinearLayout layout = (LinearLayout)findViewById(R.id.mainLayout);
layout.addView(adView);
adView.loadAd(new AdRequest());
}

but in a hour, it appeared only once. Am I doing something wrong?


It works fine but you should wait for a moment at the first time , if you want just to test you can use the test mode by adding this line (new AdRequest()).setTesting(true);


Make sure that you are using the general key and not the debug key for the AdMob API

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号