testDevices not working

75 views
Skip to first unread message

Adrian-Costin Ţundrea

unread,
Jan 12, 2014, 2:18:55 AM1/12/14
to google-adm...@googlegroups.com
Hello,

I am very new to AdMob so excuse me if I am doing something wrong, but I cannot seem to be able to turn on test ads for my real device or my emulators. Here is my code:

xmlns:googleads="http://schemas.android.com/apk/lib/com.google.ads"
        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        ads:testDevices="A40C58A681BFB6F85B2B221030259AAA"
        googleads:adSize="SMART_BANNER"
        googleads:adUnitId="@string/bottom_admob_id" />

The ads seem pretty real and I do get the "To get test ads on this device, call adRequest.addTestDevice("A40C58A681BFB6F85B2B221030259AAA");" in my LogCat.

Could you please help me out.

Thanks,
Adrian

Kunal Verma

unread,
Jan 12, 2014, 2:38:32 AM1/12/14
to Google AdMob Ads Developers
For emulator to display ads, you need to add:-

ads:testDevices="TEST_EMULATOR, A40C58A681BFB6F85B2B221030259AAA"
That is TEST_EMULATOR needs to be passed too with the device ID.
Are you including the adSize as?:-
googleads:adSize="SMART_BANNER"
googleads:adUnitId="@string/bottom_admob_id"

it needs to be:-
ads:adSize="SMART_BANNER"
ads:adUnitId="YOUR_AD_UNIT_ID"
No need to write googleads as shown here.
Another thing, I need to ask you is are you using the Latest AdMob UI. or the legacy one?
As I dont see a way to disable Test Ads in the new UI which is good. but it was available in the legacy one. So if you are on the old UI. Go to the App Setting for your app and check for the Test Mode Enabled or Disabled.

Best,
Kunal

--
 
---
You received this message because you are subscribed to the Google Groups "Google AdMob Ads Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Adrian-Costin Ţundrea

unread,
Jan 12, 2014, 2:50:05 AM1/12/14
to google-adm...@googlegroups.com
Thanks for the fast reply. I am on the new AdMob UI as I have just registered yesterday.

I have made the changes, but I am still getting real ads.

Here is the code right now:

<com.google.ads.AdView

        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
           ads:testDevices="TEST_EMULATOR, A40C58A681BFB6F85B2B221030259AAA"
        ads:adSize="@string/bottom_ad_size"
        ads:adUnitId="@string/bottom_ad_unit_id" />
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.

Kunal Verma

unread,
Jan 12, 2014, 3:14:05 AM1/12/14
to Google AdMob Ads Developers
I am not sure on real devices. But on Emulator, I am surely seeing Test Ads right now. 




To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads...@googlegroups.com.

Adrian-Costin Ţundrea

unread,
Jan 12, 2014, 3:15:53 AM1/12/14
to google-adm...@googlegroups.com
Could you tell me what is the difference (visually) between test ads and normal ones?
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsubscrib...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

Kunal Verma

unread,
Jan 12, 2014, 3:32:37 AM1/12/14
to Google AdMob Ads Developers
Yes sure.
Have attached two screenshots where just now- I am seeing test ads on an emulator with SMART_BANNER ad constant.



To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads...@googlegroups.com.
device-2014-01-12-140018.png
device-2014-01-12-140108.png

Adrian-Costin Ţundrea

unread,
Jan 12, 2014, 3:39:13 AM1/12/14
to google-adm...@googlegroups.com
Thanks. Unfortunatly what I am seeing are the real ads... In the activity I only use adView.loadAd(new AdRequest()). That is correct right?

Kunal Verma

unread,
Jan 12, 2014, 4:16:08 AM1/12/14
to Google AdMob Ads Developers
Yes. or you can load ad from XML.
 ads:loadAdOnCreate="true"
If you do the above, no need to add any adview code in Java.

To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads...@googlegroups.com.

Adrian-Costin Ţundrea

unread,
Jan 12, 2014, 1:41:24 PM1/12/14
to google-adm...@googlegroups.com
I will in a future version allow the user to opt out from the ads so I do have to load it in Java.

However my issue still remains... I am still receiving real ads instead of test ones...

C3

unread,
Jan 14, 2014, 12:58:55 PM1/14/14
to google-adm...@googlegroups.com
No it is not correct. You are telling the view to use an new request that is not in your xml. If you want to do it this way you have to tell the new request which devices to treat as a test device. For example:

               AdRequest adrequest = new AdRequest();
              
               adrequest.addTestDevice("A40C58A681BFB6F85B2B221030259AAA");
               adrequest.addTestDevice("TEST_EMULATOR");
               adView.loadAd(adrequest );

Amy Quispe (AdMob SDK Team)

unread,
Jan 16, 2014, 5:07:40 PM1/16/14
to google-adm...@googlegroups.com
Hi Adrian,

Do you still need help?

Amy Quispe

Adrian-Costin Ţundrea

unread,
Jan 16, 2014, 11:23:26 PM1/16/14
to google-adm...@googlegroups.com
Yes... unfortunatly I am still receiving real ads. I can mention I also tried adding them in directly Java... No result...

Amy Quispe (AdMob SDK Team)

unread,
Jan 22, 2014, 4:13:27 PM1/22/14
to google-adm...@googlegroups.com
Adrian,

Are you able to get test devices on an emulator? Have you successfully added your emulator as a test device?

Amy Quispe

Adrian-Costin Ţundrea

unread,
Jan 23, 2014, 1:40:26 AM1/23/14
to google-adm...@googlegroups.com
No... Unfortunately on both emulator and real device (Nexus 7) I am still getting real ads instead of test ones.

Adrian-Costin Ţundrea

unread,
Jan 24, 2014, 12:41:25 AM1/24/14
to google-adm...@googlegroups.com
Yes... you are correct. For some reason I have just received your reply on my email although you have replied on the 14th.

Adrian-Costin Ţundrea

unread,
Jan 24, 2014, 12:48:13 AM1/24/14
to google-adm...@googlegroups.com
The documention does not clearly specify that. If anyone comes across this with the same issue here is my fix:
 
A wrapper class to do the initialization (as to respect the DRY principle)
public class AdRequestWrapper extends AdRequest {
    public AdRequestWrapper(Context context) {
        super();
        addTestDevice(AdRequest.TEST_EMULATOR); //
        for (String testDevice : context.getResources().getString(R.string.test_devices).split(",")) {
            addTestDevice(testDevice);
        }
    }
}

And loading as follows:
 adView.loadAd(new adRequestWrapper(this.getApplicationContext()));

Thanks for your help,
Adrian
Reply all
Reply to author
Forward
0 new messages