Integrating with AdWhirl

Text Box


This page is a quick tutorial on how to integrate, iVdopia Ads into AdWhirl SDK's


Overview

If you are using AdWhirl system to serve ads into your application, you may integrate iVdopia Video and Banner ads into your application in a few easy steps. Please note since AdWhirl does not support PreApp, after completing this integration, you need to enable PreApp video as one of the ad Formats on iVdopia portal.

This integration will allow you to control iVdopia advertising in your apps directly from AdWhirl portal.

Although this tutorial talks about both banner and interstitial ads, iVdopia interstitial ads are best called directly using the playInApp API.



Prerequisites

You will need the following to integrate into AdWhirl.



Integration


Once you update your project with the current iVdopia SDK please follow the steps outlined below for the quickest implementation.

  1. Update your app delegate with the following:
    1. YOUR_APP_DELEGATE_CLASS.h

      #import "VDOAds.h"

      @interface YOUR_APP_DELEGATE_CLASS : NSObject <UIApplicationDelegate,VDOAdsDelegate> {
      }
      + (VDOAds *) vdoAds;
    2. YOUR_APP_DELEGATE_CLASS.m: Please note that all the methods defined here are extremely important so that you do not get any errors while compilation or during runtime


      static VDOAds *vdoAds=NULL;

      + (VDOAds *)vdoAds { return vdoAds; }

      #pragma mark -
      #pragma mark VDOAdsDelegate

      - (void) playedVDOAd {
          NSLog(@"TODO: Implement methods that continue stream playback");
      }

      - (void) noVDOAd {
          NSLog(@"TODO: Implement methods that continue stream playback");
      }

      - (void) displayedBanner {
          NSLog(@"TODO: In case you want to track vdopia banner inventory please use this function");
      }

      - (void) noBanner {
          NSLog(@"TODO: You may implement functions to replace vdopia banners with remnant network ads: mobclix, adwhirl etc.");
      }

      - (void) playedInApp {
          NSLog(@"TODO: In case you want to track vdopia Interstitial inventory please use this function");
      }

      - (void) noInApp {
          NSLog(@"TODO: You may implement functions to continue application workflow");
      }


      - (void)applicationDidFinishLaunching:(UIApplication *)application {

          CGRect frame=CGRectMake(0, 0, 320, 48);
          vdoAds=[VDOAds alloc];
          vdoAds.delegate=self;
          //- (void)openWithAppKey:(NSString*)applicationKey useLocation:(BOOL)use withFrame:(CGRect) frame
          [vdoAds    openWithAppKey:@"<YOUR_IVDOPIA_APP_KEY>" useLocation:FALSE withFrame:frame startWithBanners: FALSE];

         
      #ifdef ADWHIRL_DEBUG
        AWLogSetLogLevel(AWLogLevelDebug);
      #endif
          [window addSubview:[navigationController view]];
        [window makeKeyAndVisible];
      }


      - (void)applicationWillTerminate:(UIApplication *)application {
          // Save data if appropriate
          [vdoAds close];
      }
    3. In YOUR_AdWhirlDelegate.m:(if you have multiple AdWhirlDelegates, repeat the code in each of them).

      #import    "VdopiaView.h"

      -(void)ivdopiaBanners:(AdWhirlView *)adWhirlView {
          NSLog(@"inside function %s", __FUNCTION__);
          iVdopiaView * myView=[[[VdopiaView alloc] initWithFrame:[YOUR_APP_DELEGATE_CLASS vdoAds].adObject.bounds]autorelease];   
          [myView addSubview:[YOUR_APP_DELEGATE_CLASS vdoAds].adObject];
          [adWhirlView replaceBannerViewWith:myView];

          NSLog(@"Resuming Banners");
          [[YOUR_APP_DELEGATE_CLASS vdoAds] resumeBanners]; // Play banners
         
      }

      -(void)ivdopiaInterstitial:(AdWhirlView *)adWhirlView {
          NSLog(@"inside function %s", __FUNCTION__);
          [[YOUR_APP_DELEGATE_CLASS vdoAds] playInApp];
      }
    4. With the release of SDK version 3.4.1, a new API is available for banners. The banners can be also be used as:
      #import    "VdopiaView.h"

      -(void)ivdopiaBanners:(AdWhirlView *)adWhirlView {
          NSLog(@"inside function %s", __FUNCTION__);
          iVdopiaView * myView=[[[VdopiaView alloc] initWithFrame:[YOUR_APP_DELEGATE_CLASS vdoAds].adObject.bounds]autorelease];    
          [myView addSubview:[[YOUR_APP_DELEGATE_CLASS vdoAds] getBannerOfSize:STANDARD_IPHONE_BANNER]; // use the right constant to use the banner of correct size
          [adWhirlView replaceBannerViewWith:myView];

          NSLog(@"Resuming Banners");
          [[YOUR_APP_DELEGATE_CLASS vdoAds] resumeBanners]; // Play banners
      }
    5. On www.adwhirl.com, please define custom events ivdopiaBanners and ivdopiaIntertitial(shown below) and allocate impressions to these events as appropriate.



If you follow the above steps exactly you should be able to start seeing iVdopia ads in your AdWhirl enabled applications.