Requesting help validating my implementation of request.testDevices

98 views
Skip to first unread message

chalkta

unread,
Apr 9, 2014, 7:04:17 AM4/9/14
to google-adm...@googlegroups.com

I am using iOS 7.0, Xcode 5.1 & Kobold2D 2.1.0 and GoogleAdMobAdsSdkiOS-6.8.0 for my first app.


I have figured out I did not implement my test devices array correctly after receiving a notice from Adsense detecting invalid activity.

#define MY_SIMULATOR_IDENTIFIER D9043E32-7F7C-529B-B147-968A9EEXXXXX
#define MY_DEVICE_IDENTIFIER    9a4c2637cee36cda8ad9ce02de82119544cXXXXX
...
request
.testDevices = [NSArray arrayWithObjects:@"MY_SIMULATOR_IDENTIFIER",@"MY_DEVICE_IDENTIFIER",nil];


I have corrected my code with the following implementation, after comparing my code with results I have found on Google search.  As you see in the above code, I messed up by putting my define identifiers inside @" ".

#define GAD_SIMULATOR_ID        @"Simulator"
#define MY_SIMULATOR_IDENTIFIER @"D9043E32-7F7C-529B-B147-968A9EEXXXXX"
#define MY_DEVICE_IDENTIFIER    @"9a4c2637cee36cda8ad9ce02de82119544cXXXXX"
...
request
.testDevices = [NSArray arrayWithObjects: GAD_SIMULATOR_ID, MY_SIMULATOR_IDENTIFIER, MY_DEVICE_IDENTIFIER, nil];


I did noticed with the incorrect implementation above, that it was showing ads from companies I recognized, but thought maybe the testDevices array was being sent to Admob servers and then filtered out on the back end, since testDevices allows developers to click on the ad displayed to verify that the SDK is working correctly.  Otherwise clicking on your own ads is prohibited.  I realize now after fixing my implementation, that the Admob SDK does the filtering of test devices using the testDevices array, since with the correct implementation, I see a sample ad for apps.admob.com.


I apologies for my actions, since without testDevices configured properly, my testing was essentially stealing impressions and clicks away from Adsense advertisers!


My question to AdMob developers is whether their is any other things to look out for, related to implementing test devices with the AdMob SDK?

Eric Leichtenschlag

unread,
Apr 9, 2014, 8:35:05 PM4/9/14
to google-adm...@googlegroups.com
Using the SDK's constant GAD_SIMULATOR_ID should be sufficient for simulators instead of your MY_SIMULATOR_IDENTIFIER device ID. Your actual MY_DEVICE_IDENTIFIER doesn't look correct either - it should be 32 characters long. When running your app and making an ad request, you should get a log message like:

<Google> To get test ads on this device, call: request.testDevices = @[ @"2077ef9a63d2b398840261c8221a0xxx" ];

Insert that ID to start getting test ads.

I've brought up a discussion internally about what we could do to make it more obvious that you, the developer, has successfully enabled test mode.

Thanks,
Eric

chalkta

unread,
Apr 11, 2014, 8:09:43 AM4/11/14
to google-adm...@googlegroups.com
The following code shows test ads on my simulator and iPad:
#define MY_DEVICE_IDENTIFIER @"83762f258ea60ad3a655f171eeffXXXX"
...
request
.testDevices = [NSArray arrayWithObjects: GAD_SIMULATOR_ID, MY_DEVICE_IDENTIFIER, nil];
request
.testing = YES;

Does the 32 character AdMob assigned device identifier above ever change to a new value periodically and what would cause it to change?


I share my testing iPad with my three children, ages 3 and younger, so I would like to keep my testing iPad registered as a test device.

Eric Leichtenschlag

unread,
Apr 11, 2014, 1:12:17 PM4/11/14
to google-adm...@googlegroups.com
It's based on IDFA, so it'll change if you reset your IDFA. Otherwise it shouldn't change.

Thanks,
Eric
Reply all
Reply to author
Forward
0 new messages