Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why remove AdMob's addTestDevice() in production?

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 sets these test devices before you release your app.

Can anyone explain why? Why can't I leave the line of code that sends my particular device test ads no matter what? Doesn't this help prevent me from breaking AdMob's rules about developers not accidentally giving themselves false impressions or clicks?

like image 705
user8298723 Avatar asked Jul 13 '17 00:07

user8298723


People also ask

Why is my app not showing ads?

Ads won't show if you haven't integrated the Google Mobile Ads SDK correctly. Is your ad implementation code working properly? Test your implementation code to check that ads can show. You can also use ad inspector to test your app's ad serving.

Is there any AdMob dummy ID?

There aren't dummy ID's per se. You need to setup the XML or the JAVA code to get test ads. To get Test Ads during testing, add the following to your XML where you have the AdView declared.

How do you test a device?

#1) Phone Tester This App has an easy to use UI and can tell you if the Android Device's hardware is all up to the mark or not. By giving the necessary permissions to the app, the device can be tested for its Camera, Bluetooth, Wi-Fi, Telephone Signals, GPS status, Battery, Multi-touch, etc.


2 Answers

The reason the docs say to remove test device in production is there is a low-risk security issue whereby if you leave that code in your app, someone could theoretically deobfuscate the APK, get your hash, and detect you as the author of the app if they put some malware into a different app that you have on your device. Removing the test device ID from the app eliminates this risk.

If you're ok to assume that risk, it's better to leave the test device ID in the app, so that you can continue to click ads from that device in production without worrying about generating invalid traffic.

like image 126
Eric Leichtenschlag Avatar answered Sep 28 '22 01:09

Eric Leichtenschlag


I don't remove the testdevice directive in any of my apps. This is for my own protection - when I download my own apps from the App Store I still only want to see advertising marked as test advertising on my own devices. I have had no detrimental effects from leaving the lines of code in and most importantly it protects me from Google banning me from Admob if I inadvertently click on one of these ads. Clicking on your own non-testAd advertising that is displayed inside your own apps is particularly frowned upon by Admob. Rest assured that all other users (those not inside the testdevice directive) still see real advertising not marked as testAds.

Edit June 2019 - I still do this 2 years later. In the latest Admob API's you will see real advertising for real companies, but it will have a small "TestAd" text over the top of it. This signifies that the ad is marked as a test ad, and you won't be penalised by Admob for clicking on it. Never click on your own ads without the TestAd text!!!

like image 42
Peter Smith Avatar answered Sep 28 '22 02:09

Peter Smith