Example Sample Code

Example Sample Code

#import "LVDOInterstitialView.h" #import "LVDOAdSize.h" #import "VDOAdRequest.h" #import <CoreLocation/CoreLocation.h>   @interface ControllerName ()<CLLocationManagerDelegate> { CLLocationManager *locationManager; BOOL findLocation; } @property(nonatomic,strong) LVDOInterstitialView * interstitial; @implementation InterstitialExampleViewController - (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 { // START CODE HERE // Replace "AX123" with Your SSP API Key self. interstitial = [[LVDOInterstitialView alloc] initWithAdUnitID:@"AX123" delegate:self interstitialType: interstitialAdTypeVideo viewControllerForPresentingModalView:self];   // Starting to put together the ad request details [VDOAdRequest adRequestSharedInstance];   // Set keywords for your app NSArray *array = [NSArray arrayWithObjects:@"Keyword1",@"Keyword2",@"Keyword3",@"Keyword4", 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. interstitial load:[VDOAdRequest adRequestSharedInstance]]; [locationManager stopUpdatingLocation]; } - (void)dealloc { self. interstitial = nil; } # pragma mark - VDOInterstitialDelegate Methods - (void)onInterstitialLoaded:(LVDOInterstitialView*)interstitialAd{ [self.interstitial show]; } - (void)onInterstitialFailed:(LVDOInterstitialView*)interstitialAd errorCode:(int)errorCode { } - (void)onInterstitialShown:(LVDOInterstitialView*)interstitialAd{ } - (void)onInterstitialClicked:(LVDOInterstitialView*)interstitialAd{ } - (void)onInterstitialDismissed:(LVDOInterstitialView*)interstitialAd{ self.interstitial = nil; } @end