Haha,it is really cool, you must be interested to integrate ad in your own app.Here is a good news.You can use this library to create Google Admob's banner,intersitial or reward video quickly.Use this library,you only need to write one line code ,then you can make money.If you like this easy library,please start it,thanks!
To run the example project, clone the repo, and run pod install
from the Example directory first.
Target: iOS 7.0+ device
XTAdMobHelper is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'XTAdMobHelper'
[[XTAdMobHelper sharedAdMobHelper] showNewBannerWithAdSize:kGADAdSizeBanner origin:CGPointMake((SCREEN_SIZE.width-kGADAdSizeBanner.size.width)*0.5, SCREEN_SIZE.height-kGADAdSizeBanner.size.height) adUnitID:@"ca-app-pub-3940256099942544/2934735716" rootViewController:self onView:self.view testMode:NO testDeviceId:@"e7204ccc3c166fcc5cec7ac8bd3c7c8e"];
First, you need to preload this intersitial ad:
[[XTAdMobHelper sharedAdMobHelper] preloadNewIntersitialWithAdUnitId:@"ca-app-pub-3940256099942544/4411468910" testMode:YES testDeviceId:@"e7204ccc3c166fcc5cec7ac8bd3c7c8e" receiveHandle:nil openHandle:nil closeHandle:nil];
Second, you need to present this ad at the right time:
[[XTAdMobHelper sharedAdMobHelper] preloadNewIntersitialWithAdUnitId:@"ca-app-pub-3940256099942544/4411468910" testMode:YES testDeviceId:@"e7204ccc3c166fcc5cec7ac8bd3c7c8e" receiveHandle:nil openHandle:nil closeHandle:nil];
First, you need to preload this reward video ad:
[[XTAdMobHelper sharedAdMobHelper] preloadRewardVideoWithAdUnitId:@"ca-app-pub-2089092182326765/9979233626" testMode:YES testDeviceId:@"e7204ccc3c166fcc5cec7ac8bd3c7c8e" receiveHandle:^(){
} openHandle:nil closeHandle:nil rewardHandle:^(GADAdReward *reward) {
NSString *rewardMessage = [NSString stringWithFormat:@"Reward received with currency %@ , amount %lf", reward.type,[reward.amount doubleValue]];
NSLog(@"%@", rewardMessage);
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Reward" message:rewardMessage delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alertView show];
} failedHandle:nil];
Second, you need to present this ad in right event action:
[[XTAdMobHelper sharedAdMobHelper] presentRewardVideoImediatelyInRootViewController:self];
Another way,if you want to present the ad immediately after receive action.You can also just write only one line code as below:
[[XTAdMobHelper sharedAdMobHelper] preloadRewardVideoWithAdUnitId:@"ca-app-pub-2089092182326765/9979233626" testMode:YES testDeviceId:@"e7204ccc3c166fcc5cec7ac8bd3c7c8e" receiveHandle:^(){
[[XTAdMobHelper sharedAdMobHelper] presentRewardVideoImediatelyInRootViewController:self];
} openHandle:nil closeHandle:nil rewardHandle:^(GADAdReward *reward) {
NSString *rewardMessage = [NSString stringWithFormat:@"Reward received with currency %@ , amount %lf", reward.type,[reward.amount doubleValue]];
NSLog(@"%@", rewardMessage);
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Reward" message:rewardMessage delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alertView show];
} failedHandle:nil];
Start to set target:
[[XTAdMobHelper sharedAdMobHelper] startAccuracyTartgetWithGender:kGADGenderUnknown birthDate:(BirthDate){1970,2,11} location:(Location){} keywords:nil contentUrl:nil requestAgent:nil childDirectedTreatment:ChildTreatmentStyleNone];
Stop the target settings:
[[XTAdMobHelper sharedAdMobHelper] stopAccuracyTarget];
ronniechen888, 576892817@qq.com
XTAdMobHelper is available under the MIT license. See the LICENSE file for more info.