如何在Admob Android中为AdView添加动态广告?

时间:2017-03-20 12:07:44

标签: android admob

这是我的代码:

AdView mAdView;
MobileAds.initialize(this, "ca-app-pub-9233630887794553~4351962429");
// Gets the ad view defined in layout/ad_fragment.xml with ad unit ID set in
// values/strings.xml.
mAdView = (AdView) findViewById(R.id.ad_view);
mAdView.setAdUnitId(getString(R.string.banner_ad_unit_id));

AdRequest adRequest = new AdRequest.Builder()
                .build();

mAdView.loadAd(adRequest);

1 个答案:

答案 0 :(得分:0)

点击此链接中的2个答案:admob only sends test ad not real ads

发布您的应用,实时广告会自动发布。