Example Sample Code

Example Sample Code

#import "LVDOAdView.h" #import "LVDOAdSize.h" #import "VDOAdRequest.h" #import <CoreLocation/CoreLocation.h>   @interface  InViewExampleViewController ()<CLLocationManagerDelegate> { CLLocationManager *locationManager; BOOL  findLocation; } @property(nonatomic,strong) LVDOAdView * vdoAdView; @implementation InViewExampleViewController - (void)viewDidLoad { [super viewDidLoad]; findLocation = YES; locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; locationManager.desiredAccuracy = kCLLocationAccuracyBest; if ([locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) { [locationManager requestWhenInUseAuthorization]; } [locationManager startUpdatingLocation]; } #pragma mark – CLLocationManagerDelegate - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error {   if (findLocation) { CLLocation *clocation = [[CLLocation alloc] initWithLatitude:34.05 longitude:118.25]; [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:34.05 longitude:118.25]; [self performSelectorOnMainThread:@selector(hitRequestToLoadAd:) withObject:clocation waitUntilDone:NO]; } } findLocation = NO; }   #pragma mark Ad Load Method -(void)hitRequestToLoadAd:(CLLocation *)location { // Enable InView Push-Down or InView In-Line // For InVIew Push-Down // self. vdoAdView = [[LVDOAdView alloc] initWithAdUnitId:@"AX123" size:adSizeIABMRECT delegate:self viewControllerForPresentingModalView:self];   // For InVIew In-Line self. vdoAdView = [[LVDOAdView alloc] initWithAdUnitId:@"AX123" size:adSizeInView delegate:self viewControllerForPresentingModalView:self];   // Starting to put together the ad request details [VDOAdRequest adRequestSharedInstance];   // Set keywords for your app NSArray *array = [NSArray arrayWithObjects:@"TEST",@"TEST1",@"TEST2",@"TEST3", 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 setLocation:location]; [self. vdoAdView loadAd:[VDOAdRequest adRequestSharedInstance]]; [self.view addSubview:self.vdoAdView.view]; [locationManager stopUpdatingLocation]; } #pragma mark VDOBannerAdListenerDelegate Listeners - (void)onBannerAdLoaded:(LVDOAdView*)banner { } - (void)onBannerAdFailed:(LVDOAdView*)banner errorCode:(int)errorCode { self. vdoAdView = nil; } - (void)onBannerAdClicked:(LVDOAdView*)banner { } // call dealloc - (void)dealloc { self. vdoAdView = nil; } @end