Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Admob test devices not showing simulator udid

I am implementing Admob on iOS app.

I just downloaded Admob sample code and when I tried to run it on simulator, my console is saying "To get test ads on this device, call: request.testDevices = NSArray arrayWithObjects:@"GAD_SIMULATOR_ID", nil];".

So, I added my mac udid and a testing device udid to an array and set that to request. But, still, app is showing the default banner instead of ads from my admob account. Also console is saying the same above message. Have anyone had any idea what am I missing here? Here is the code.

self.adBanner = [[[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner
                                              origin:origin];
self.adBanner.adUnitID = kSampleAdUnitID;
self.adBanner.delegate = self;
[self.adBanner setRootViewController:self];
[self.view addSubview:self.adBanner];
self.adBanner.center = CGPointMake(self.view.center.x, self.adBanner.center.y);
GADRequest *request = [GADRequest request];
request.testing = YES;
request.testDevices = [NSArray arrayWithObjects: @"XXXX-XXXX-XXXX-XXXX-XXXXXXXX",
                                            @"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
                                            nil];
[self.adBanner loadRequest:request];

BTW, I replaced the above kSampleAdUnitID with my Admob publisher ID and XXX with my mac id and device id.

like image 974
Murali Patteboyina Avatar asked May 03 '13 04:05

Murali Patteboyina


2 Answers

Enable test ads

On your iDevice, go to Settings > Privacy > Advertising and disable the 'Limit Ad Tracking' option. Then when you run your app on hardware, check Xcode's console: there you will see the ID, which you can add to the testDevices array.

like image 57
klaevv Avatar answered Oct 19 '22 13:10

klaevv


The Devce Id you need is the MD5 hash of the advertising identifier for your phone. I downloaded an app called 'The Identifiers' link here which gives you all the information you need.

Add the MD5 hash of the advertising identifier to the testDevices array in the createView method and you will then see adds in your app.

var ad1 = Admob.createView({
             height: 50,
             top: 0,
             debugEnabled: true, // If enabled, a dummy value for `adUnitId` will be used to test
             adType: Admob.AD_TYPE_BANNER,
             adUnitId: 'ca-app-pub-000000xxxxxxxxxx/8204200000', // You can get your own at http: //www.admob.com/
             adBackgroundColor: 'black',
             testDevices: [Admob.SIMULATOR_ID,'xxxc8xx0xxxccxxb4a12cxxxxxxxxxxx'], // You can get your device's id by looking in the console log
              dateOfBirth: new Date(1985, 10, 1, 12, 1, 1),
              gender: Admob.GENDER_MALE, // GENDER_MALE or GENDER_FEMALE default: undefined
             contentURL: 'https://admob.com', // URL string for a webpage whose content matches the app content.
             requestAgent: 'Titanium Mobile App', // String that identifies the ad request's origin.
    extras: {
       'version': 1.0,
       'name': 'Eyespy'
    }, // Object of additional infos
    tagForChildDirectedTreatment: false, // http:///business.ftc.gov/privacy-and-security/childrens-privacy for more infos
     keywords: ['keyword1', 'keyword2']
     });

    $.adview.add(ad1);
like image 28
Mike Avatar answered Oct 19 '22 13:10

Mike