I know Android AdMob guidelines strictly prohibit developers to do this. I made my app and integrated the AdMob SDK and tested everything with the test IDS provided by google. Everything works fine and now i want to publish my app to the play store but before that i have to replace the test ids with the real ones and test if everything works as expected. My question is how can i do that when google clearly states never to use real ids in a test?
Asked
Active
Viewed 509 times
1 Answers
0
You can use your real AdUnitId
and add your Device as a test device. This way, on that device, test ad will be loaded instead of read Ads (even using your real AdUnitID). Any other device will show proper Ads.
An Example:
mAdView = new AdView(this);
mAdView.setAdSize(AdSize.SMART_BANNER);
mAdView.setAdUnitId(getResources().getString(R.string.ad_unit_it_for_banner));
mAdView.loadAd(new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("58BCAB123132131231321F81BE28AA59")
.addTestDevice("B9C8B123132131132159568D9F2D56EE")
.addTestDevice("2A06465461314647987874984514DEC4")
.build());
On the example above, I'm adding emulator and 3 more real devices as Test Devices.
In this picture, you can see how you can get your Device ID (from logcat):

guipivoto
- 18,327
- 9
- 60
- 75