I'm making an application including admob ads with help of this google's official tutorial
However, it states "You should always use test ads when developing and testing your app--testing with live production ads is a violation of AdMob policy and could cause your account to be suspended".
So I now have a test and a production Ad Unit ID. Should I manually switch my code to production/test id during my application release process or is there an kind of automatic for this?
Thank you
you can use the production Ad Unit ID for your testing. just include the test device and it'll automatically load the test ads.
private static final String TEST_DEVICE ="xxxx..."; //see Log cat for the value.
AdRequest adrequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice(TEST_DEVICE)
.build();
if (adview !=null)
adview.loadAd(adRequest);
see this post on how to get the TEST_DEVICE id How can I get device ID for Admob
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With