Archived‎ > ‎

Integrating Android SDK (pre V2)


Overview

iVdopia provides a Software Development Kit (SDK) that can be integrated with your Android application with just a few lines of code. The SDK includes documentation, sample code, and a distributable jar that can be packaged with the application.

The iVdopia Android SDK can be downloaded from here. SDK version 1.4.7 allows you to add the following ad formats.

  • Pre-App Videos: 5 to 15 sec video advertisement (with a SKIP AD option after 5 sec of video ad) runs while the application loads.
  • In-App Videos: 5 to 15 sec video advertisement (with a SKIP AD option after 5 sec of video ad) runs during the application play. You can call this advertisement anytime during the application play such as in between game levels, before any video/audio etc. Typical use of In-App video advertisements is as follows:
    • Between Game Levels
    • As a preroll video (before a video playback)
    • As a postroll video (after a video playback)
  • Banner Ads: 320X48px banner advertisement that changes every 30 sec. Banner ads displaying the same brand message reinforcing the advertiser brand. These can be placed on the screen at any place.

Creating an iVdopia-enabled Android app involves the following steps:

  • Obtain the SDK from iVdopia.
  • Integrate the SDK with your Application.
  • Obtain an API key for your application and configure ads using iVdopia's publisher portal.
  • Test ad delivery to your application using an Android device.
  • Distribute your application on the Android marketplace.
  • Monitor your application's performance and earnings using iVdopia's publisher portal.
Note that the Android emulator does not display videos well, so you will need to use a real device for testing.

Integration

Set up the project

  • Add iVdopia_Android_SDK_v1.1.1.jar to your build path.
  • Modify your projects AndroidManifest.xml file to include iVdopia elements.
    • Include a description of the Activity that will display video ads.
      	
      <activity android:name="com.vdopia.client.android.VDOActivity"
      android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
      android:screenOrientation="landscape"
      android:configChanges="orientation|keyboardHidden" />
    • Include the description of Ad View in all the layout xml files in which you want to show banner ads
      	
      <com.vdopia.client.android.VDOView"
      android:id="@+id/ad"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      ... />
      You can tweak the layout based on the design of the rest of the page.
    • Request the INTERNET permission for the application.
      <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Call iVdopia API's from your code

  • For pre-app ads, launch the iVdopia activity when your application is launched
    import com.vdopia.client.android.*;
    ...
    VDO.initialize("<Your API key here>", this);
    Intent next = new Intent();
    next.setClass(this, VDOActivity.class);
    next.putExtra(VDO.INTENT_EXTRA_KEY_AD_TYPE, VDO.AD_TYPE_PRE_APP_VIDEO);
    startActivity(next);
  • For in-app ads, launch the iVdopia activity at suitable points in your application
    import com.vdopia.client.android.*;
    ...
    VDO.initialize("<Your API key here>", this);
    Intent next = new Intent();
    next.setClass(this, VDOActivity.class);
    next.putExtra(VDO.INTENT_EXTRA_KEY_AD_TYPE, VDO. AD_TYPE_IN_APP_VIDEO);
    startActivity(next);

Listening to Ad Events

This is optional. If you want to listen to vdopia ad events i.e. adShown or noAdsAvailable then you can implement VDO.AdEventListener interface. Following is the interface definition:
interface AdEventListener {
  public void adStart(int type); 
  public void adShown(int type);
  public void noAdsAvailable(int type, int willCheckAgainAfterSeconds);
}
For example you can create a class VdopiaEventListener which implements this interface:
class VdopiaEventListenr implements VDO.AdEventListener {
  public void adStart(int type) {
    //do something
  }  
  public void adShown(int type) {
    //do  something
  }
  public void noAdsAvailable(int type, int willCheckAgainAfterSeconds) {
    //do something
  }
}
Then you can create an instance of this class and call setListener on VDO:
VDO.setListener(new VdopiaEventLister());
type is the Ad type and willCheckAgainAfterSeconds is the duration after SDK will try to show this type of Ad again. Following are the available Ad types:
VDO.AD_TYPE_PRE_APP_VIDEO = 0xAD01
VDO.AD_TYPE_IN_APP_VIDEO = 0xAD02
VDO.AD_TYPE_BANNER = 0xAD06
You need to take care of your listener Object in case of your Activity gets destroyed/crashed.

Checking for Ad availability

Again this is optional. If you want to check for ad availability before launching the activity to show the video ad or before placing the banner view, it is possible through the following API.

VDO.isAdAvailable(int adType, Context ctx)
where adType is one of the types specified in the "Listening to Ad Events" section.

Example app
A very simple example app can be downloaded from http://market.android.com/details?id=com.ivdopia.sample.marketdemo (link only works from an Android device). This app demonstrates the different ad formats available.

Testing

No programming is complete without testing, so here are suggestions for testing the API in the test mode (Please Note:if you are in Live mode it is best to create an App/API key that is in the test mode). Even if you plan not to enable Pre-App advertisements you should test that they work well with your application. 
Cases:
  1. On the portal please enable all advertisements, and disable Advanced Targeting
    Once you have installed the SDK and ready for testing it on device. Delete the entire installation of your application on the device, and then install the application on your device

    Expected behavior:
    1. The first time you start you should see no Pre-App Video advertisement
    2. If you spend enough time on your application, and In-App calls are made in your program, you should start seeing Video advertisements while the application is playing, at the location where In-App calls are being made
    3. Some test video advertisements are frequency capped at 10 in which case you need to delete the application and redo the test case
  2. On the portal please enable all advertisements, enable Advanced Targeting
    Delete the entire installation of your application from your device and then install the application on your device or simulator

    Expected behavior:
    1. Two video ad campaigns are enabled in test mode a) one campaign with frequency cap of 10 per day b) another campaign with Advanced targeting and no frequncy cap. The campaign with Advanced targeting shows a question only once on one device (for each application) if answered, else if the question is skipped it is shown every hour.
    2. The first time you start you should see no Video advertisement
    3. If In-App is called before video advertisments are cached, you should see an interface prompting the user for some information relating to the targeting advertiser selects for his campaign.
    4. If In-App is called afterward, however this interface will not show until the other campaign hits its maximum (10) in case of testing
    5. Once the other video campaign hits day-max (10) the interface prompting the user for information will appear.
    6. If in the prompt you mention the information that the targeting requires to pass (Typically if DoB indicates that age > 21) new advertising will start to appear
    7. For re-test simply delete the application and test again
  3. On portal disable all advertisements, do not delete the application from the device

    Expected behavior:
    1. In test mode: Within couple of minutes no advertising will be served, it will stop within couple of minutes on the client side as well
    2. In live mode: Within couple of minutes no advertising will be served, however advertising will take upto 12 hours to stop on the client side
Subpages (1): Integrating with Adwhirl
Comments