I want to place an admob ad at the bottom of my apk, but the ad never show, and there is no layout xml in my apk,the layout is build up by an gameview class,
LogCat says:onFailedToReceiveAd(Ad request successful,but no ad returned due to lack of ad inventory)
here is my code
gameView = new GameView(this, display.getWidth(), display.getHeight());
setContentView(gameView);
RelativeLayout viewLayout = new RelativeLayout(GameActivity.this);
RelativeLayout.LayoutParams flLP2 = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
// Create the adView
AdView adView =开发者_运维知识库 new AdView(this, AdSize.BANNER, "xxxxxx");
// Add the adView to it
viewLayout.addView(adView,flLP2);
// Initiate a generic request to load it with an ad
AdRequest adTest = new AdRequest();
adTest.addTestDevice("xxxxxxxxxx");
adView.loadAd(adTest);
Are you using the correct test device id? Check the logcat log (tag "Ads"), there should be a line saying:
Ads: To get test ads on this device, call adRequest.addTestDevice("xyz");
精彩评论