Imran Ahmed
Imran Ahmed

Reputation: 800

How AdMob identifies that it is a test device or real user?

I am creating an app with AdMob ads, and I have provided my test device id so that my account is not banned.

But when I am finished developing, I want to install the real app on the same device and use it as a normal user would.

Is my device still supposed to be a test device?

How does google identify that it is a test device? I guess it should be looking for the debug or release flavor of the app to decide this, but I just want to be sure.

Upvotes: 3

Views: 4080

Answers (2)

Android Surya
Android Surya

Reputation: 544

For Testing purpose you will add below lines.

.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)        // All emulators

.addTestDevice("AC98C820A50B4AD8A2106EDE96FB87D4")  // An example devic ID

If you remove .addTestDevice() This will be treated as a live Device.

For more information look at this url:

https://developers.google.com/admob/android/targeting#test_ads

Upvotes: 0

Jörn Buitink
Jörn Buitink

Reputation: 2916

When running your App in Debug mode, you should get the following message in your logcat:

I/Ads: Use AdRequest.Builder.addTestDevice("XXXXXXXXXXXXXXXXXXXXXXXXX") to get test ads on this device.

This is exactly the code you have to use to add a test device. In Release mode, simply remove this line of code (or change it depending on product flavor) to get real ads.

But most likely you will test your app in release mode on the same device, too. So maybe it is a bad idea to remove your test device from the admob list of test devices.

Upvotes: 3

Related Questions