Reputation: 21627
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 void 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?
Upvotes: 1
Views: 766
Reputation: 1081
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);
Upvotes: 1
Reputation: 10462
Make sure that you are using the general key and not the debug key for the AdMob API
Upvotes: 0