简体   繁体   中英

How to test Admob in real device if without Ad unit id

I am trying to use Google mobile ads, how can I test my application if I do not have AdUnitId which you have to pay to get? can I test it on real device?

UPDATE:

Creating an admob account is free. However, you can use these dummy adunit IDS for testing:

Banner : ca-app-pub-3940256099942544/6300978111

Source

Interstitial: ca-app-pub-3940256099942544/1033173712

Source

You can also add emulator and actual device ids for testing:

   AdView adView = (AdView)this.findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder()
        .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
        .addTestDevice("TEST_DEVICE_ID")
        .build();
    adView.loadAd(adRequest);

This way your account won't be flagged for invalid clicks that leads to bans.

You dont have to pay to open admob account. But, if you still want to test without an account, add your device ID to the adrequest, and you will see demo ads.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM