Search code examples
iosobjective-cadmobads

My test iOS devices generated real adMob clicks?


I'm new in AdMob. I started from today to edit my 1st app. I use Google manual and some other helps, because I'm trying to keep iAd and I want to use AdMob if iAd is not available etc.. So, I put my 2 test devices (iPhone and iPad) in the following rows:

GADRequest *request = [GADRequest request];
request.testDevices = @[ @"xxxxxxxx", @"xxxxxxxx" ];
[self.admobBannerView loadRequest:request];

where in the place of xxxxxxxx are my devices IDs. I got these IDs from the debugger when I run AdMob on the device for the first time.

For 2 or 3 minutes when I start testing my banners in all my screens, the banners are OK - test banners, 320x50 pixels etc.. but after that I see that the banners become real. Yes, I tried to click 3 or 4 times on these "real" banners, yes, they are real! And I am a violator, yes? :) I refresh my stats and I see about 20 cents... all these impressions and clicks are generated from my tests devices and I'm worried about all of this situation. I want to use not only simulator. Thanks!

Edited to include code from comment:

Here is the rest of my adMob code:

self.admobBannerView.delegate = self; 
[self.view addSubview:self.admobBannerView]; 
[self.admobBannerView loadRequest:[GADRequest request]]; 

Is this loadRequest (2nd) is my mistake?


Solution

  • Run your app on your device. In the Debug Area AdMob will give you your test id. It should look similar to this:

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

    Take this and request an ad with it. For example, you would request an interstitial test ad like so:

        // AdMob Interstitial
        interstitial_ = [[GADInterstitial alloc] init];
        interstitial_.adUnitID = MY_INTERSTITIAL_UNIT_ID;
        GADRequest *request = [GADRequest request];
        request.testDevices = @[@"insertTestDeviceNumberHere"];
        [interstitial_ loadRequest:request];
    

    Then, to get live AdMob ads again, just remove or comment out request.testDevices = @[@"insertTestDeviceNumberHere"];


    Edited to account for code added by user:

    Your problem is in this line: [self.admobBannerView loadRequest:[GADRequest request]];

    With [GADRequest request] you are creating a brand new request. Change it to:

        GADRequest *request = [GADRequest request];
        request.testDevices = @[ @"insertTestDeviceNumberHere"];
        [self.admobBannerView loadRequest:request];
        [self.view addSubview:self.admobBannerView];