Why do I need to remove AdMob addTestDevice ()?

On this page

https://developers.google.com/admob/android/test-ads#add_your_test_device

it says

Note. Be sure to remove the code that installs these test devices before releasing your app.

Can anyone explain why? Why can't I leave the line of code that sends the test declaration of my particular device no matter what? Wouldn't that stop me from breaking AdMob's rules that developers don't accidentally give themselves false impressions or clicks?

+5


source to share


3 answers


If you have an addTestDevice () application, the user will not be able to see the real ads, no matter what device ID is passed to the method.



This test should only be used when testing.

-five


source


I am not removing the testdevice directive in any of my applications. This is for my own protection - when I download my own apps from the App Store, I still want to see ads flagged as test ads on my own devices. I have not had any negative consequences from leaving lines of code, and most importantly, it protects me from being banned by Google from Admob if I accidentally click on one of these ads. Admob especially discourages clicking on your non-testAd ads that appear in your own apps. Be sure that all other users (not in the testdevice directive) are still seeing real advertisements not marked as testAds.



Edit June 2019 - I am still doing this 5 years later. In the last API of Admob, you will see real ads for real companies, but on top of it there will be a small "TestAd" text. This means that the ad is marked as a test ad and Admob will not be penalized for clicking it.

+6


source


There is no exact reason why this line should be removed to use test devices for advertising. Generally, when releasing applications, all traces for testing and debugging should be removed so as not to interfere with the release of the version of your application and to avoid any holes in your application. With this line in your code, it means that if someone uses a device to test your application with the same test ID, you won't get anything from admob, because it uses the test device ID and not the actual device ID. What I usually do is just comment this out for easy testing later when changing my app to release a different version.

0


source







All Articles