2
我想在我的廣告,以創建AdMob橫幅出現,但它不顯示出來,這是我在logcat中得到:無法獲得AdMob廣告在libgdx遊戲
02-23 14:52:11.943: I/Ads(13358): Scheduling ad refresh 60000 milliseconds from now.
02-23 14:52:11.943: I/Ads(13358): Ad finished loading.
02-23 14:53:11.992: I/Ads(13358): Ad is not visible. Not refreshing ad.
在我的代碼,我使用2個屏幕,一個叫做TitleScreen,另一個叫做GameScreen,我的遊戲課叫做SimonSays。
這是我在MainActivity.java的Android代碼:
RelativeLayout layout = new RelativeLayout(this);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
View gameView = initializeForView(new SimonSays(), true);
AdView AdView = new AdView(this);
AdView.setAdSize(AdSize.SMART_BANNER);
AdView.setAdUnitId("***"); //Secret
AdRequest.Builder adRequest = new AdRequest.Builder();
adRequest.addTestDevice("7C4216C9F2879CE166853D136DCC4F32"); //My Galaxy S4
AdView.loadAd(adRequest.build());
layout.addView(gameView);
RelativeLayout.LayoutParams adParams =
new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
adParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
adParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
layout.addView(AdView, adParams);
setContentView(layout);
initialize(new SimonSays(), cfg);
非常感謝!這工作 – Jolly