Example Sample Code
Code Excerpt from App Delegate
#import "VDOAdRequest.h" #import <CoreLocation/CoreLocation.h> #import <AVKit/AVKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate,CLLocationManagerDelegate> { CLLocationManager *locationManager; BOOL findLocation; } @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. [[UIApplication sharedApplication]setStatusBarHidden:YES]; findLocation = YES; locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; locationManager.desiredAccuracy = kCLLocationAccuracyBest; if ([locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) { [locationManager requestWhenInUseAuthorization]; } [locationManager startUpdatingLocation]; return YES; } - (void)dealloc { locationManager = nil; } #pragma mark - CLLocationManagerDelegate - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { if (findLocation) { CLLocation *clocation = [[CLLocation alloc] initWithLatitude:0.0 longitude:0.0]; [self performSelectorOnMainThread:@selector(hitRequestToLoadAd:) withObject:clocation waitUntilDone:NO]; } findLocation = NO; } - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { CLLocation *currentLocation = newLocation; if (currentLocation != nil) { if (findLocation) { [self performSelectorOnMainThread:@selector(hitRequestToLoadAd:) withObject:currentLocation waitUntilDone:NO]; }} else { if (findLocation) { CLLocation *clocation = [[CLLocation alloc] initWithLatitude:0.0 longitude:0.0]; [self performSelectorOnMainThread:@selector(hitRequestToLoadAd:) withObject:clocation waitUntilDone:NO]; } } findLocation = NO; } - (void)hitRequestToLoadAd:(CLLocation *)location { // Starting to put together the ad request details [VDOAdRequest adRequestSharedInstance]; [VDOAdRequest setSkipButtonPisition:SkipButtonPositionTop]; // Set keywords for your app NSArray *array = [NSArray arrayWithObjects:@"BOOK",@"MOVIES",@"GAMES",@"APPS", nil]; // It is recommended that you update the below parameter - accurate info is required [VDOAdRequest setAppStoreUrl:@"<https://itunes.apple.com//please-URL-encode>"]; [VDOAdRequest setRequester:@""<publisher_name>"]; [VDOAdRequest setAppDomain:@"<app-name.com>"]; [VDOAdRequest setCategory:@"<IAB_Category>"]; [VDOAdRequest setPublisherDomain:@"<publisher-domain.com>"]; // Passing on the following parameter values can result in better targeting and higher yield // For parameters you cannot populate, please comment them out [VDOAdRequest addKeyword:array]; [VDOAdRequest setBirthdayWithMonth:2 day:12 year:1990]; [VDOAdRequest addGender:@"m"]; [VDOAdRequest addMaritalstatus:@"Married"]; [VDOAdRequest setDmaCode:@"327788"]; [VDOAdRequest setEthnicity:@"Asian"]; [VDOAdRequest setMetro:@"XYZ"]; [VDOAdRequest setAge:45]; [VDOAdRequest setCurrPostal:@"122016"]; [VDOAdRequest setPostalCode:@"122001"]; [VDOAdRequest setGeo:@"India:Haryana:Gurgaon"]; [VDOAdRequest setLocationWithLatitude:location.coordinate.latitude longitude:location.coordinate.longitude accuracy:4]; [VDOAdRequest adRequestSharedInstance]; [VDOAdRequest saveAdUnitID:@"AX123"]; [[VDOAdRequest adRequestSharedInstance] fetchPrerollAdWithAdUnitID: [VDOAdRequest getAdUnitID] adSize:CGSizeMake(320, 480)]; } Code Excerpt from Preroll View Controller #import "VDOAdRequest.h” @implementation PrerollViewController - (void)dealloc { [[VDOAdRequest adRequestSharedInstance] stopPrerollAd]; } - (void)viewDidLoad { [super viewDidLoad]; [VDOAdRequest adRequestSharedInstance]; [[VDOAdRequest adRequestSharedInstance] setPrerollAdDelegate:self]; [[VDOAdRequest adRequestSharedInstance] showPrerollAdOnView:self.view mainContentURL:@"https://cdn.vdopia.com/files/happy.mp4" playContentVideoInFullScreenMode:YES]; } #pragma mark - Ad callback delegate methods - (void)onPrerollAdLoaded { } - (void)onPrerollAdFailed:(int)errorCode { } - (void)onPrerollAdClicked { } - (void)onPrerollAdCompleted { } #pragma mark - main content callback - (void)mainContentOnPrepare:(AVPlayerViewController*)mediaPlayer { } - (void)mainContentDidFailWithError:(NSError*)error playerInstance:(AVPlayerViewController*)mediaPlayer { } - (void)mainContentFinish:(AVPlayerViewController*)mediaPlayer { NSLog(@"----------- Main Content Finished ---------"); } - (void)didMoveToParentViewController:(UIViewController *)parent { if(parent == nil) { [[VDOAdRequest adRequestSharedInstance]stopPrerollAd]; } } - (UIViewController *)viewControllerForPresentingModalView { return self; }