James Jones
James Jones

Reputation: 572

Test AdMob ads in Android

So I'm new to using AdMob and had a question on how to correctly use/implement it. Google tells me to use test ads while developing (if I use real ads it is a violation of their policy), how do I have test ads in development and then real ads in production or while my is in the play store? I'm sure this is simple, thanks for your help!

Upvotes: 2

Views: 9753

Answers (2)

CodeChimp
CodeChimp

Reputation: 4835

You can specify a test banner ad unit id for dev versions. ca-app-pub-3940256099942544/6300978111

The banner example provided by Google here specifies this in a string resource. Using gradle build flavours you could easily specify different resource files with different id's for dev and production.

Upvotes: 6

Simas
Simas

Reputation: 44168

You can specify your device id as a test device:

AdRequest adRequest = new AdRequest.Builder()
        .addTestDevice("0FA20932AFE1095798444FD9AAB7D425")
        .build();

Then whenever you run the application on this device, you get test ads, and on all the other devices you get the real deal.

To get the device id, run your app with ads turned on and watch the log.

Upvotes: 7

Related Questions