RevMob Android SDK - Quick Start



It takes 5 simple steps to start monetizing:

  1. Sign up, register your media and get your Media Id
  2. Download our SDK
  3. Add the Library to your project
  4. AndroidManifest: add the required permission, the media id and the fullscreenActivity (if using fullscreen or video ads)
  5. Implement the Native Button code

Sign Up

  1. Sign up through our home page
  2. On the bottom of the Monetization page, click on 'Add Android App'
  3. You'll now find your app on Monetization page. Get your Media ID there, we'll use it in a minute: media_id

Download

Download android - 9.0.8


Add Library

Requirements: Android 2.1 (API level 7) or higher. Rich ads are supported only for API level 11 or higher. Video and Rewarded Video ads require Android version higher than 4.1.X.

  1. Unzip the download and you'll find our Sample Apps for Eclipse and Android Studio (they are a good source if you have any doubts)
  2. Our SDK (.jar file) is in revmob-android-sdk-X.X.X/yourfavouriteIDE/libs (EX: revmob-android-sdk-9.0.6/android-studio-sample/libs)
  3. Add the revmob.jar into your project in your libs directory (you can create a new folder if you don't have it - follow our SampleApp's structure)
  4. Linking android_studio_jar
    1. Android Studio: Right-click the revmob.jar file on Android Studio and "add as library" (if you can't find it, go to your project explorer, click on the box that says "Android" and select "Project" - see image on the right)
    2. Eclipse: Right-click the revmob.jar file on Eclipse, select Build Path > Add to Build Path.

Android Manifest

Here's where we'll use the Media ID you got in the Sign Up session.

In your AndroidManifest.xml file add the following code inside the <manifest></manifest> tag.

    <!-- Required -->
    <uses-permission android:name="android.permission.INTERNET"/>

    <application>
        <!-- RevMob Media ID -->
        <meta-data android:name="com.revmob.app.id" android:value="copy_your_RevMob_Media_ID_here"/>
    </application>

Basic Code

Alright, we're almost there! All we need to do now is import the SDK, Start RevMob's session and add an ad.

"To Start RevMob's session" means to establish communication with our servers. You can only use advertising methods after you receive the confirmation that it's started, which is made by using RevMob's listeners (event handlers, called delegates in iOS).

When our onRevMobSessionIsStarted listener is called we're ready to go. You can even already call an ad as soon as that happens, check full guide:

import com.revmob.RevMob;
import com.revmob.RevMobAdsListener;

public class YourActivity extends Activity {

    private RevMob revmob;
    private Activity currentActivity;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        currentActivity = this;

        revmob = RevMob.startWithListener(this, new RevMobAdsListener() {
            //Check full guide to implement ad units here
        });

    }
}

With this code you're ready to show some ads! Come on, give it a try!

If you want a bit more of complexity, check the next session.

If you want other ad units (native link, native button, banner, popup, video or rewarded video), check our full guide.

Native Button

This ad unit is even simpler to integrate than the Native Link. Internally, it is almost the same case, but the advantage is that there is no need to write any extra code, only include the button inside your XML file:

    <com.revmob.ads.button.RevMobButton
        android:layout_width="fill_parent"
        android:layout_height="38dp"
        android:layout_margin="5dp"
        android:text="<Button text (this field can be null)>"
        android:background="@drawable/button3"/>  <!-- Replace for any background you want (e.g. @drawable/image) -->
        <!-- This button3 layout is in android-studio-sample/src/main/res/drawable-hdpi if you want to use it, but we recommend creating your own native layout -->

If you want to make it dynamically, see Native Link.

Contact

If you have any issues integrating RevMob SDK, take a look at our SDK Forum.

There you can find other developers' questions & answers that may help you out.

If your problem is a new one, in order to speed up the process, please attach on your post the console logs printed by the following command (it's a summary of your environment information).

RevMob revmob = RevMob.start(this, REVMOB_APP_ID);
revmob.printEnvironmentInformation(this);