Buda Gavril
Buda Gavril

Reputation: 21627

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 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

Answers (2)

sami boussacsou
sami boussacsou

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

Rohit Mandiwal
Rohit Mandiwal

Reputation: 10462

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

Upvotes: 0

Related Questions