Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing AdMob before publishing

I'm just finishing my first app for Android and iOS, made in Unity3D. I used a Unity Plugin to add an addmob banner to it and tested it in a Android Device. The banner showed just fine.

I now created an account in addMob, manually added my app to it (since it's not on any store yet), got the Add Unit ID, put it into my code.

I now need to test it and I don't know how to do that. I know I'm not supposed to click my own banners, but how do I know if it's working before sending it to the AppStore or GooglePlay?

Thank you.

like image 817
DanielFox Avatar asked Jul 22 '26 10:07

DanielFox


2 Answers

For the version of Admob using the Google Play services library, you can only achieve this in the code, not in the XML files.

All is explained in this documentation.

Basically here is how to do, just enter the following lines, the method addTestDevice will allow you to add the devices used during your tests:

AdRequest adRequest = new AdRequest.Builder()
        .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
        .addTestDevice("INSERT_YOUR_HASHED_DEVICE_ID_HERE")
        .build();
like image 177
Yoann Hercouet Avatar answered Jul 23 '26 23:07

Yoann Hercouet


You can set the device you are working on as your test-device. For example, I have the following configured for my AdView

<com.google.ads.AdView 
    android:id="@+id/adView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    ads:adUnitId="APP_ID"
    ads:adSize="SMART_BANNER"
    ads:loadAdOnCreate="true" 
    ads:testDevices="TEST_DEVICE_ID" />

When you fill in your TEST_DEVICE_ID from your Android device (there is plenty on the internet available on how to obtain TEST_DEVICE_ID, e.g.: here), you'll get your test-banners on your device, even if your app is on Google Play.

I compared my app installed on a test-device and an app installed on another device: The test-device got a test-ad, whereas the other device got a "real" ad. I just took some screenshots from my that might give you a better comparison.

Hereafter a screenshot from my production app on my test-device:

Production App, test device

Hereafter a screenshot from my test app on my "test enabled" device:

Test App, test-enabled device

Hereafter a screenshot from my test app on my "test disabled" device

Test App, test-disabled device

Whether you add your device as test device in XML or code, I don't think it should matter. But anyway, screenshots above were for the XML implementation.

like image 34
Steven De Bock Avatar answered Jul 24 '26 00:07

Steven De Bock



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!