What does adRequest.addTestDevice ("device_id") mean?

I am confused about AdMob Adrequest . I don’t understand adRequest.addTestDevice("device_id")

.

If I write:

AdRequest adRequest = new AdRequest.Builder()
                .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
                .addTestDevice(DeviceInfo.getDeviceId(activity)).build();

      

Will this affect my AdMob account for each device? Or addTestDevice ("deviceid") for each testing device or real device only? If I only add my test device ID to AdRequest, will it serve ads on other devices or not?

+3


source to share


3 answers


According to the docs :

It is important that you always ask for test ads when developing and testing your applications. Testing with live ads, in-production ads is a violation of AdMob's policy and may result in your account being suspended. For more information on using test ads, see our Ad Targeting Guide .



This means your account will not be affected when using test ads no matter how many devices / emulators you use. Basically addTestDevice ("deviceid") prevents false impressions and ensures that test ads are always available.

You can remove all calls to addTestDevice ("deviceid") when you're done testing and moving to production.

+6


source


AdRequest adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).addTestDevice("1915F1CFC0D22C6DBB4C8ED97B0CCBA1").build();

      



This is how you should add your device id, you can get your device id from your logs in android studio . and test ads will be loaded for this device only.

+1


source


According to Google's policy, if you want to test ads, you need to define a device ID for testing in your application, or if you do not identify a device for testing and do not test this application many times on the same device, then Google will consider it as illegal activity. Thus, we need to define the ID of the test device in our debug applications.

Note. Don't click on ads even if you've added the device ID to your app. This will be considered a violation of the rules and your account may be blocked. You can only check which ads are visible in your application or not.

As @AnkitaKoladiya's answer pointed out, you can use this:

AdRequest adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();

      

You can use it as shown below to avoid accidentally generating a signed APK with device ID for testing:

AdRequest.Builder builder = new AdRequest.Builder();
if (BuildConfig.DEBUG) {
    builder.addTestDevice(AdRequest.DEVICE_ID_EMULATOR);
}
builder.build();

      

This will not include builder.addTestDevice(AdRequest.DEVICE_ID_EMULATOR);

when generating a signed APK. But this will include this in Dubug or a test APK file. All devices that install the APK with this line ( builder.addTestDevice(AdRequest.DEVICE_ID_EMULATOR);

) will be considered a testing device. Therefore, you need to remove this when you create a signed APK for Playstore.

And if you don't find your device ID, then first run the app without checking the device ID on your testing device. After a successful build, you will see your device ID in Logcat .

+1


source







All Articles