开发者

android admob sdk error

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜