AdView仅在模拟器上显示测试横幅

时间:2015-06-13 07:12:38

标签: android admob

我刚刚在AdMobs上创建了一个帐户,为测试创建了横幅。

代码来自BannerExample,没有addTestDevice(...)

  <?php
     if (get_magic_quotes_gpc()) {
$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
while (list($key, $val) = each($process)) {
    foreach ($val as $k => $v) {
        unset($process[$key][$k]);
        if (is_array($v)) {
            $process[$key][stripslashes($k)] = $v;
            $process[] = &$process[$key][stripslashes($k)];
        } else {
            $process[$key][stripslashes($k)] = stripslashes($v);
        }
    }
}
unset($process);}
 ?>

activity_my.xml

public class MyActivity extends ActionBarActivity {

private AdView mAdView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_my);

    // 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);

    // Create an ad request. Check logcat output for the hashed device ID to
    // get test ads on a physical device. e.g.
    // "Use AdRequest.Builder.addTestDevice("ABCDEF012345") to get test ads on this device."
    AdRequest adRequest = new AdRequest.Builder()
            .build();

    // Start loading the ad in the background.
    mAdView.loadAd(adRequest);
}

但是当我启动应用程序时,我只看到Test横幅。

我应该指定别的东西,看看真正的横幅吗?

1 个答案:

答案 0 :(得分:2)

尝试在真实设备中查看它。添加通常不会在模拟器中显示。