Skip to content

Getting Started

Farzad Seid Arabi edited this page Jan 30, 2017 · 7 revisions

This document details the process of integrating the Sabavision SDK with your Android application. If you have any questions, don't hesitate to email us at [email protected].

Here are the basic integration steps:

  1. Check out the files from our repository.
  2. Add our SDK (and dependencies) to your project.
  3. Create ad units in your app.

##Getting Started

  • Before integrating rewarded video ads in your app, you’ll need create an account on Sabavision and integrate the SDK into your project Getting Started Guide, .
  • Add a rewarded video ad unit to your app in the Sabavision dashboard.
  • Make sure you have added the ad network SDKs you wish to use to your app.

Download the Sabavision Android SDK

The Sabavision SDK is available via:

  1. Download AAR and volley.jar

    The Sabavision SDK is also distributed as zipped aar file that you can include in your application.

    Sabavision Android SDK.zip
    _Includes everything you need to serve Sabavision ads.

  2. Cloned GitHub repository

    Alternatively, you can obtain the Sabavision SDK files by cloning the git repository:

    git clone git://github.com/sabavision/sabavision-android-sdk.git

Requirements and Dependencies

  • Android 2.3.1 (API Version 9) and up
  • android-support-v4.jar, r22 (Updated in 3.7.0)
  • android-support-annotations.jar, r22 (Updated in 3.7.0)
  • android-support-v7-recyclerview.jar, r22 (Updated in 3.9.0)
  • Sabavision Volley Library
  • Recommended Google Play Services 7.8.0

Gradle Integration

Adding as Compiled .aar

To add the Sabavision SDK as an .aar in your project, navigate to the Sabavision SDK in your terminal and run the following command gradle sabavision-sdk:build. This will build an AAR that bundles the sabavision-volley-1.1.0.jar.

Copy the .aar to your library directory: cp build/outputs/aar/sabavision-sdk.aar $MY_LIB_DIR where $MY_LIB_DIR is your default library directory. cp build/outputs/aar/sabavision-volley.aar $MY_LIB_DIR where $MY_LIB_DIR is your default library directory.

Open your project's build.gradle file and add the below lines:

repositories {
  jcenter()
  flatDir {
    dirs '$MY_LIB_DIR'
  }
}

// ...

dependencies {
  compile(name:'sabavision-sdk', ext:'aar')
  compile(name:'sabavision-volley', ext:'aar')
}

Updating your Android Manifest

Your AndroidManifest.xml will need to be updated in order to complete the SDK integration. Add the following permissions and activity declarations according to the bundle you are integrating.

Declare the following permissions:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Note: ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION are only needed if you want the device to automatically send the user's location for targeting. WRITE_EXTERNAL_STORAGE is optional and only required for MRAID 2.0 storePicture ads.

Declare the following activities in your <application>:

<activity android:name="com.sabavision.mobileads.SabavisionActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.sabavision.mobileads.MraidActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.sabavision.common.SabavisionBrowser" android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.sabavision.mobileads.MraidVideoPlayerActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>

Add this tag to your <application> to use Google Play Services:

<meta-data android:name="com.google.android.gms.version"
      android:value="@integer/google_play_services_version" />

Displaying Ads

Once you've completed the above steps, you can start displaying ads in your application by following the simple instructions on the Banner Ad or Interstitial Ad pages.