Admobs Banner不显示Libgdx

时间:2014-12-21 19:10:09

标签: java libgdx admob

大家好我试图在我的游戏中实施Admobs但是我一直被困在最近2天的横幅广告中。我的代码如下。

public class MainActivity extends AndroidApplication {
private String adId = "ca-app-pub-3083731858905600/3602333561";
private String deviceId = "D117452E0EC02313A049B184D977046B";

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
    cfg.useGL20 = false;

    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 FMGame(), cfg);

    AdView AdView = new AdView(this);
    AdView.setAdSize(AdSize.BANNER);
    AdView.setAdUnitId(adId); 

    AdRequest.Builder adRequest = new AdRequest.Builder();
    adRequest.addTestDevice(deviceId); 
    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 FMGame(), cfg);
}
}

我的admob帐户说我的游戏正在发送请求,但横幅广告不会显示。

我的logcat说广告不可见,因为我的声誉不到10个

由于

p.s我已经在这个网站上拖了几天,并尝试了许多不同的解决方案,请帮助....

0 个答案:

没有答案