RevMob Android SDK

Advertisement - Install Report

RevMob SDKs can be used by advertisers who want to report the installation of the advertised app. Reporting installation is very simple and starting RevMob session is enough.

Testing Mode

While you are developing your app, you will probably want to test two scenarios:

  1. RevMob SDK shows you an advertisement successfully;
  2. RevMob SDK does not deliver an advertisement for any reason.

By activating Testing Mode you can reproduce these two scenarios easily and do not need to worry about statistics, since the impressions/clicks/installs will not be counted while it is 'on'.

You can turn it on/off whenever you want through the Edit Media page (in your 'Monetization' tab, click on the Edit button of the App you want to test).

Remember to turn it off in order to start Monetizing!

        
    

Configuration

    <!-- Required -->
    <uses-permission android:name="android.permission.INTERNET"/>
    <!-- Strongly recommended (for better segmentation) -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <application>
        <!-- Declare RevMob activity -->
        <activity android:name="com.revmob.ads.fullscreen.FullscreenActivity"
                  android:theme="@android:style/Theme.Translucent"
                  android:configChanges="keyboardHidden|orientation">
        </activity>

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

Listeners - Delegates

First thing you will need to do is to define a class that implements the RevMobAdsListener interface.

With Listeners (also known as Delegates or Callbacks) you can follow the our SDK workflow. Here is an example of how implement this class:

RevMobAdsListener revmobListener = new RevMobAdsListener() {

    // Required
    @Override
    public void onRevMobSessionIsStarted() {
        Log.i("[RevMob]", "RevMob session is started");
    }

    @Override
    public void onRevMobSessionNotStarted(String message) {
        Log.i("[RevMob]", "RevMob session failed to start");
    }

    // Optional
    @Override
    public void onRevMobAdDisplayed() {
        Log.i("[RevMob]", "onAdDisplayed");
    }

    @Override
    public void onRevMobAdReceived() {
        Log.i("[RevMob]", "onAdReceived");
    }

    @Override
    public void onRevMobAdNotReceived(String message) {
        Log.i("[RevMob]", "onAdNotReceived");
    }

    @Override
    public void onRevMobAdDismissed() {
        Log.i("[RevMob]", "onAdDismissed");
    }

    @Override
    public void onRevMobAdClicked() {
        Log.i("[RevMob]", "onAdClicked");
    }
};

Check the RevMobAdsListener to see all the functions you can implement in your listener.

Start Session

Before showing any ads, you must start a RevMob session.

import com.revmob.RevMob;

public class YourMainActivity extends Activity {
    private RevMob revmob;

    public void onCreate(Bundle savedInstanceState) {

        // ... previous code ... //

        // Starting RevMob session
        revmob = RevMob.startWithListener(this, revmobListener);
    }
}

You can also put this code inside the onResume method. Check the Activity Lifecycle for more details.

Link

The Link is the easiest and the most eficient ad unit to integrate in your app. As the example above, you just have to call revmob.openLink(this), and that is it. It redirects the user to the advertised mobile application download page.

A common usage is to associate the link to a "more games" button or to a custom banner.

public class YourActivity extends Activity {

    public void yourButtonClicked() {
        revmob.openLink(this); // call it wherever you want to open the link ad
    }

    // ... your code ... //
}

Button

This ad unit is even simpler to integrate than the 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:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
    <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) -->
</LinearLayout>

Fullscreen

Fullscreen is the ad unit with the highest eCPM. You can show it in the beginning or in the end of a round, for example. There are two ways to show a fullscreen ad:

Few steps

With your session started, you can call showFullscreen whenever you want to. This will fetch an ad and show it as soon as it is loaded.

import com.revmob.RevMob;

public class YourActivity extends Activity {
    private RevMob revmob;

    public void gameOverScreen() {
        revmob.showFullscreen(this, revmobListener); // without pre-loading the ad, the ad will take more time to be displayed
    }

    // ... your code ... //
}


Advanced

Using showFullscreen without createFullscreen will always result in an interstitial (not video):

import com.revmob.RevMob;
import com.revmob.ads.fullscreen.RevMobFullscreen;
import com.revmob.RevMobAdsListener;

public class YourActivity extends Activity {
    private RevMob revmob;
    private RevMobFullscreen fullscreen;
    private boolean adIsLoaded = false;

    RevMobAdsListener revmobListener = new RevMobAdsListener() {

        // Required
        @Override
        public void onRevMobSessionIsStarted() {
            loadFullscreen() // pre-load it without showing it
        }

        public void onRevMobAdReceived() {
            adIsLoaded = true; // Now you can show your fullscreen whenever you want
        }
    }

    public void loadFullscreen() {
        fullscreen = revmob.createFullscreen(this, revmobListener);
    }

    public void gameOverScreen() {
        if(adIsLoaded) fullscreen.show(); // call it wherever you want to show the fullscreen ad
    }

    // ... your code ... //
}


Rewarded Video

Only supported by SDK version 9 or later.

Rewarded Videos are a great way to monetize interacting with your user. The most common way to display them is by showing a pre-roll text box inviting them to watch the ad and then a post-roll text box letting them know they earned the reward. We designed 7 amazing pre-roll and post-roll boxes for you to use. You can activate and personalize them through our console. If you don't want to use them, you can also use yours.

Here is an example of how it can be implemented:

import com.revmob.RevMob;
import com.revmob.ads.fullscreen.RevMobFullscreen;
import com.revmob.RevMobAdsListener;

public class YourActivity extends Activity {
    private RevMobFullscreen rewardedVideo;
    private boolean rewardedVideoIsLoaded = false;

    RevMobAdsListener revmobListener = new RevMobAdsListener() {

        // Required
        @Override
        public void onRevMobSessionIsStarted() {
            loadRewardedVideo(); // pre-load it without showing it
        }

        public void onRevMobRewardedVideoLoaded() {
            rewardedVideoIsLoaded = true; // Now you can show your rewarded video whenever you want
        }
    }

    public void loadRewardedVideo() {
        rewardedVideo = revmob.createRewardedVideo(this, revmobListener);
    }

    public void gameOverScreen() {
        if(rewardedVideoIsLoaded) rewardedVideo.showRewardedVideo();
    }

    // ... your code ... //
}

Video

Only supported by SDK version 9 or later.

Video ads are top performers on both user satisfaction and monetization.

Here is an example of how it can be implemented:

import com.revmob.RevMob;
import com.revmob.ads.fullscreen.RevMobFullscreen;
import com.revmob.RevMobAdsListener;

public class YourActivity extends Activity {
    private RevMobFullscreen video;
    private boolean videoIsLoaded = false;

    RevMobAdsListener revmobListener = new RevMobAdsListener() {

        // Required
        @Override
        public void onRevMobSessionIsStarted() {
            loadVideo(); // pre-load it without showing it
        }

        public void onRevMobVideoLoaded() {
            videoIsLoaded = true; // Now you can show your rewarded video whenever you want
        }
    }

    public void loadVideo() {
        video = revmob.createVideo(this, revmobListener);
    }

    public void gameOverScreen() {
        if(videoIsLoaded) video.showVideo();
    }

    // ... your code ... //

Banner

The banner ad is an Android View. You can add it programmatically or using the Android layout files.

Here is an example using a LinerLayout, declared in a layout xml file (main.xml):

<LinearLayout android:id="@+id/banner"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content" >
</LinearLayout>

And in the activity, put the banner as a child of a LinearLayout:

import com.revmob.ads.banner.RevMobBanner;

public class YourActivity extends Activity {
    RevMobAdsListener revmobListener = new RevMobAdsListener() {

        // Required
        @Override
        public void onRevMobSessionIsStarted() {
            showBanner();
        }
    }

    void showBanner() {
        banner = revmob.createBanner(this, revmobListener);
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                ViewGroup view = (ViewGroup) findViewById(R.id.banner);
                view.addView(banner);
            }
        });
    }
}


Custom size

By default the banner fits all available widths, adjusting the height to keep the aspect ratio constant. You can also provide a custom width and/or height. If you provide a layout_width param, the banner will try to fit the entire width and adjust the height; If you provide a layout_height param, the banner will try to fit the entire height and adjust the width; If you provide both, a layout_width and a layout_height, the banner will try to fit the whole area. If you set layout_width and/or layout_height, include the attribute android:visibility="gone" to the layout, example:

<LinearLayout android:id="@+id/banner"
               android:layout_width="100dp"
               android:layout_height="wrap_content"
               android:visibility="gone">
</LinearLayout>

Popup

Popup is the simplest ad unit. We recommend it only for apps that will be intensively used by old devices with a slow internet connection. For all the other cases, we recommend you to use the fullscreen or video ad unit.

Few steps

With your session started, you can call showPopup whenever you want. This will fetch an ad and show as soon as possible.

import com.revmob.RevMob;

public class YourActivity extends Activity {
    private RevMob revmob;

    public void gameOverScreen() {
        revmob.showPopup(this); // without pre-loading the ad, the ad will take more time to be displayed
    }

    // ... your code ... //
}


Advanced

Using showPopup without createPopup will request the link and then automatically open it. Using this method, you will need to wait until the popup is loaded before show it, which will cause a delay. If you want to avoid this delay and have the ad pre-loaded, just follow these steps:

import com.revmob.RevMob;
import com.revmob.ads.popup.RevMobPopup;
import com.revmob.RevMobAdsListener;

public class YourActivity extends Activity {
    private RevMob revmob;
    private RevMobPopup popup;
    private boolean popupIsLoaded = false;

    RevMobAdsListener revmobListener = new RevMobAdsListener() {

        // Required
        @Override
        public void onRevMobSessionIsStarted() {
            loadPopup() // pre-load it without opening it
        }

        public void onRevMobAdReceived() {
            popupIsLoaded = true; // Now you can open your link whenever you want
        }
    }

    public void loadPopup() {
        popup = revmob.createPopup(this, revmobListener);
    }

    public void gameOverScreen() {
        if(popupIsLoaded) link.open(); // call it wherever you want to open the link ad
    }

    // ... your code ... //
}


Placement IDs

Placement ID is an optional feature recommended for experient publishers. If you want to enable/disable specific ad units in real time, or, if you want to have an exclusive tracking for an ad unit, you must use Placement IDs (do not confuse with Media ID). First of all, you need to create one or more Placement IDs (for each ad unit) in the RevMob Console. Then copy the corresponding ID, and pass it through the ad method calls.

These are some methods you can call to use Placement IDs:

// replace these Placement IDs for your own.
revmob.createFullscreen(this, "copy your fullscreen placement ID here", revmobListener);
revmob.createLink(this, "copy your link placement ID here", revmobListener);
revmob.createBanner(this, "copy your banner placement ID here", revmobListener);
revmob.createPopup(this, "copy your popup placement ID here", revmobListener);

Timeout

You can change the connection timeout to the RevMob servers, if necessary.

RevMob revmob = RevMob.start(this, REVMOB_APP_ID);
revmob.setTimeoutInSeconds(5);

Higher eCPM Data-Targeted Ads

If you can, it would be a great idea to send some information in order to enable RevMob to serve better-targeted ads. This can increase your eCPM and revenue.

Example:

RevMob revmob = RevMob.start(this, REVMOB_APP_ID);
revmob.setUserEmail("user@email.com");
revmob.setUserGender(RevMobUserGender.FEMALE);
revmob.setUserPage("facebook.com/revmob");
revmob.setUserAgeRangeMax(21);
revmob.setUserAgeRangeMin(18);
revmob.setUserBirthday(new GregorianCalendar(1990, 01, 01));
ArrayList<String> interests = new ArrayList<String>();
interests.add("games");
interests.add("mobile");
interests.add("advertising");
revmob.setUserInterests(interests);

You can also send the location information by using the location manager:

LocationManager locationManager = (LocationManager) getApplicationContext().getSystemService(Context.LOCATION_SERVICE);
Location gpsLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
Location netLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);

if (gpsLocation != null) {
    revmob.setUserLocation(gpsLocation.getLatitude(), gpsLocation.getLongitude(), gpsLocation.getAccuracy());
}
else if (netLocation != null) {
    revmob.setUserLocation(netLocation.getLatitude(), netLocation.getLongitude(), netLocation.getAccuracy());
}

If you send the location information, you will have to add this required permission in your AndroidManifest.xml:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

Contact

If you are having any issue to integrate the RevMob SDK, check our RevMob Forum Site where you can find posts from other RevMob's publishers and maybe find the same issue that you're experiencing.

In order to better assist you, please, attach in your post the console logs printed by the following command that print a summary of your environment configuration.

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

Download

Download android - 9.0.4

Requirements

Android 2.1 (API level 7) or higher. Rich ads are supported only for API level 11 or higher.

Change Log (yyyy/mm/dd)

9.0.4 (2015/08/12)

  • NewImportant Added Revmob button (ad unit).
  • BugfixImportant Fixes an important issue affecting part of the clicks, lowering the eCPM.

9.0.1 (2015/05/28)

  • Bugfix Fixes to a couple listeners: onRevMobRewardedVideoStarted and onRevMobAdDismissed.

9.0.0 (2015/05/19)

  • New Added video ads, rewarded video ads and support to VAST.
  • New Refreshable banners.
  • Important Many internal improvements and performance enhances.

7.0.0 - 2014/11/28

  • Important Fixes violations in the newest Google's Policy for advertising.
  • Important Fixes issues that were causing the SDK to be flagged by some antivirus.

6.9.8 - 2014/09/26

  • UpdateImportant Internal improvements.

6.9.7 - 2014/09/01

  • BugfixImportant Fixes rotations in banner.

6.9.6 - 2014/07/10

  • BugfixImportant Click listener for fullscreen was being called twice.

6.9.5 - 2014/06/11

  • UpdateImportant Internal improvements.

6.9.4 - 2014/05/30

  • NewImportant No more Eula for the app user.

6.9.3 - 2014/05/28

  • NewImportant New listeners for Eula popup window (details)
  • NewImportant New public methods for accepting and rejecting the Eula programmatically - ONLY for testing purposes (details)

6.9.2 - 2014/05/21

  • NewImportant End user must agree with RevMob terms (EULA)
  • NewImportant Support for Google ID for Advertisement (details)
  • Update Internal improvements.

6.9.1 - 2014/05/15

  • ImportantBugfix Fixed an issue that crashes app when calling ad in testing mode.

6.9.0 - 2014/05/12

  • NewImportant New listeners for start session (documentation).
  • Update Internal improvements.

6.8.3 - 2014/04/17

  • Update Internal improvements.

6.8.2 - 2013/12/12

  • Update Internal improvements.

6.8.1 - 2013/12/09

  • Update Internal improvements.

6.8.0 - 2013/11/29

  • Update- Important Now, the only required permission is INTERNET.

6.7.0 - 2013/11/04

  • Bugfix ShowBanner() method crashed when the device was rotated.
  • New Parallax effect on fullscreen ads (disabled by default, check out the sample app inside the SDK).
  • Update Internal improvements.

6.6.0 - 2013/10/10

  • Update Internal changes that may increase performance and the eCPM.

6.5.0 - 2013/10/08

  • Update showBanner with more options.
  • New hideBanner for hide the banner displayed with showBanner.

6.4.4 - 2013/09/30

  • Bugfix Fixed issue on banner animation.
  • Update hideBanner method renamed to hide.

6.4.3 - 2013/09/26

  • New New method showBanner where it may be the ideal option to use banner in games.
  • Update Banner animations.

6.4.2 - 2013/09/17

  • Update Internal improvements for Fullscreen ads.

6.4.1 - 2013/09/10

  • Update FullscreenActivity validation. Better logs and avoid unecessary crashes.

6.4.0 - 2013/08/28

  • Update Internal improvements.

6.3.1 - 2013/08/26

  • Delete Notification removed to respect the new Google policy.

6.3.0 - 2013/08/13

  • New The RevMob Media ID must now be configured in the AndroidManifest.xml file.
  • Update Old RevMob.start method is deprecated.

6.2.11 - 2013/08/08

  • New Fullscreen animations.

6.2.10 - 2013/08/05

  • Bugfix Added revmob.jar to the sample app
  • Delete Removed the option to set your project property to merge our manifest file.

6.2.9 - 2013/07/25

  • Update Added more Lookout requirements.

6.2.8 - 2013/07/24

  • New You can set your project property to merge our manifest file.

6.2.7 - 2013/07/19

  • Update Added more Lookout requirements.

6.2.6 - 2013/07/05

  • Update Notification ad now requires user's approval.
  • Update Added Lookout requirements.

6.2.5 - 2013/07/04

  • Update Internal improvements.

6.2.4 - 2013/06/13

  • Update Internal improvements for geolocation.

6.2.3 - 2013/06/10

  • New You can add device location and social information for higher eCPM.

6.2.2 - 2013/03/14

  • Optimization Improved the memory usage of fullscreen.
  • Update Internal improvements that may increase the eCPM.
  • Bugfix Bugfix with SSL connections for old Android versions.

6.2.1 - 2013/03/21

  • Update Internal improvements.

6.2.0 - 2013/03/20

  • Update Android permissions validations (logs to alert implementation issues).
  • Update Internal improvements.

6.1.0 - 2013/03/19

  • Update Lots of internal improvements that will increase the eCPM significantly.
  • Update More information in the printEnvironmentInformation method.
  • Delete Method isLoaded removed from all unit classes.
  • New New wrapper methods in the RevMob class.

6.0.0 - 2013/02/25

  • New New method in the facade to avoid typing the AppId more than once. RevMob.session(activity). It must be called only after the RevMob.start() method.
  • Update Better statistics control.
  • Update Internal improvements.
  • Update Better error messages.
  • Update Better examples in the sample app.

5.2.3 - 2013/01/30

  • Update Important internal improvements.

5.2.2 - 2013/01/21

  • Update- Important isLoadedAd renamed to isLoaded.
  • Update Added placement id validation.
  • Update Added activity validation.
  • Bugfix Created workaround to the Android WebView bug, which does not process the html properly.
  • Bugfix Fixed ExceptionInitializerError exception for some particular usage.
  • Bugfix Fixed NullpointerException for some particular use of the fullscreen.

5.2.0 - 2013/01/09

  • Update Removed exception message of a warning in the Notification ad.
  • Bugfix Notification ad deal with activities that has multiple orientation.
  • Update Internal improvements and optimizations in Fullscreen ad.

5.1.1 - 2012/12/17

  • New New ad unit: Notification.
  • Update Internal improvements.

5.0.0 - 2012/12/10

  • Update- Important showFullscreenAd renamed to showFullscreen.
  • Update- Important EnvironmentConfig.setTestingMode removed. Now, use RevMob.setTestingMode(RevMobTestingMode.SOMEOPTION)
  • Update- Important Fullscreen renamed to RevMobFullscreen, Banner to RevMobBanner, Popup to RevMobPopup and Link to RevMobLink.
  • New Added a sample app in the distribution package.
  • New Now it is possible to customize network timeout: RevMob.setTimeoutInSeconds(int);
  • New Added Media ID validation.
  • New Added adDisplayed event to the RevMobAdsListener.
  • New Added show/hide methods for fullscreen and popup and open/cancel for ad link, that may be used with pre-load.
  • New Added pre-load for Popup.
  • Update Examples of usage in API reference.
  • Update Better log messages.
  • Update Internal improvements.

4.3.0 - 2012/11/21

  • Update New RevMob Link interface

4.2.9 - 2012/10/23

  • Bugfix Avoid memory leaks when get errors on show Fullscreens.

4.2.8 - 2012/10/16

  • Bugfix Avoid NullPointerException on get static assets.

4.2.7 - 2012/10/05

  • Bugfix RevMobAdsListener.onRevMobAdDissmiss() not being called.

4.2.4 - 2012/10/01

  • Bugfix Avoid NullPointerException on create Fullscreen Ad.
  • Bugfix Catches SocketException.

4.2.3 - 2012/09/27

  • Bugfix Avoid NullPointerException on click an Ad.

4.2.2 - 2012/09/24

  • Update Deprecated openAdLink without RevMob listener.
  • New createBanner method without RevMob listener but with placement id.

4.2.0 - 2012/09/19

  • New Ads with placements.
  • New Many improvements in banner ad.
  • Update Better log messages.

4.1.8 - 2012/09/13

  • Bugfix Avoid memory leaks on show fullscreens

4.1.7 - 2012/09/12

  • Bugfix Avoid error 404 error on openAdLink.
  • New openAdLink uses RevMobAdsListener.

4.1.0 - 2012/09/05

  • Update Improvements in banner ad.
  • Update Better logging.
  • New Testing mode.

4.0.3 - 2012/08/28

  • Update Minor improvements in RevMob session Start.

4.0.2 - 2012/08/24

  • Update Minor improvements to be used in RevMob Unity package.

4.0.1 - 2012/08/22

  • Update Internal improvements in the Fullscreen Ad.

4.0.0 - 2012/08/20

  • New Changed session management to use RevMob object.
  • Bugfix Fixed bug on open Amazon Store.
  • Update Improvements on Fullscreens.
  • Update OpenAdLink calls in background, so it does not freezes the app while redirecting.

3.5.0 - 2012/08/08

  • New The method RevMobAds.startSession is now mandatory. The entire facade change to only this method receive the RevMob Media ID.
  • New Open advertisements in Amazon App Store for Amazon Campaigns (not yet implemented in server).
  • New RefMovAds.printEnvironmentInformation method to facilitate send us information about issues.
  • Update Now the SDK supports only one Media Id per application.
  • Bugfix Fullscreen rotation is now supported in Unity engine.
  • Bugfix Simulator does not crash when the user try to open the app store.

3.4.3 - 2012/08/03

  • New Added destroy session.

3.4.2 - 2012/08/02

  • Update Removed old Fullscreen implementation.

3.4.1 - 2012/08/01

  • New Using a time window to avoid consecutives calls on start session.

3.4.0 - 2012/07/31

  • New Created start session.

3.3.1 - 2012/07/30

  • Bugfix Avoid out of memory errors: Release Fullscreen Ad.

3.3.0 - 2012/07/26

  • New Fullscreen Ad is an Activity.
  • Bugfix RevMob android sdk works on simulator.
  • Delete EnvironmentConfig.setDebugMode() no longer exist. It is not necessary anymore.

3.2.7 - 2012/07/25

  • Bugfix IllegalStateException on click twice in Fullscreen.

3.2.6 - 2012/07/19

  • Bugfix Removed SSLExceptions on android 2.3.x.
  • Update Fullscreen dialog is shown and updated on ad received.

3.2.5 - 2012/07/18

  • Bugfix Removed NetworkOnMainThreadException in Fullscreen click.

3.2.4 - 2012/07/12

  • Bugfix Avoid NullPointerException when receive empty responses.

3.2.3 - 2012/07/05

  • Bugfix Fixed IllegalStateException scheme 'market' not registered.

3.2.1 - 2012/07/02

  • Update Updated polish translation.

3.2.0 - 2012/06/29

  • New Added Open ad link.

3.1.0 - 2012/06/18

  • New Added Fullscreen ad image placeholder.