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.
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.
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With