RevMob Android SDK

Configuration

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

Start Session

Before showing any ads, you must start a RevMob session with your RevMob App ID.

<application>
    <meta-data android:name="com.revmob.app.id" android:value="copy your RevMob App ID here"/>
</application>
import android.os.Bundle;
import android.app.Activity;
import android.view.View;

import com.revmob.RevMob;

public class YourMainActivity extends Activity {
    private RevMob revmob;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Starting RevMob session
        revmob = RevMob.start(this); // RevMob App ID configured in the AndroidManifest.xml file
    }
}

Testing Mode

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

Activating the testing mode you are allowed to reproduce these two scenarios easily. And you do not need to worry about statistics because the prints/clicks/installs are not counted.

You can activate the testing mode whenever you want to as soon as RevMob session has been started. Just be sure to disable/delete the testing mode before publishing your app to the store.

revmob = RevMob.start(this);
revmob.setTestingMode(RevMobTestingMode.WITH_ADS); // with this line, RevMob will always deliver a sample ad
revmob.setTestingMode(RevMobTestingMode.WITHOUT_ADS); // with this line, RevMob will not delivery ads

Proguard

If you are using proguard in your Eclipse project, you may have to add the following line in your proguard.cfg.

-dontwarn org.apache.commons.codec.binary.Base64

If you have any question regarding the proguard configuration for the RevMob integration, please contact us.

Fullscreen

Fullscreen is a ad unit with a high eCPM. You can show it in the beginning or in the end of a round, for example.

To show a Fullscreen Ad you need to:

public class YourActivity extends Activity {
    public void onResume(Bundle savedInstanceState) {
        super.onResume(savedInstanceState);
        setContentView(R.layout.activity_main);

        RevMob revmob = RevMob.start(this, REVMOB_APP_ID);
        revmob.showFullscreen(this);
    }
}
import com.revmob.ads.fullscreen.RevMobFullscreen;

public class YourActivity extends Activity {
    private RevMobFullscreen fullscreen;

    public void onResume(Bundle savedInstanceState) {
        super.onResume(savedInstanceState);
        setContentView(R.layout.activity_main);

        RevMob revmob = RevMob.start(this, REVMOB_APP_ID);
        fullscreen = revmob.createFullscreen(this, null); // pre-load it without showing it
    }

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

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 {
    public void onResume(Bundle savedInstanceState) {
        super.onResume(savedInstanceState);
        setContentView(R.layout.main);

        RevMob revmob = RevMob.start(this, REVMOB_APP_ID);
        RevMobBanner banner = revmob.createBanner(this);
        ViewGroup view = (ViewGroup) findViewById(R.id.banner);
        view.addView(banner);
    }
}

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>

Link

Use the Link to redirect 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. Be sure you are using listeners to check if the link was loaded successfully, otherwise you create a workaround for this situation, like hide the button.

import com.revmob.ads.banner.RevMobLink;

public class YourActivity extends Activity {
    public void onResume(Bundle savedInstanceState) {
        super.onResume(savedInstanceState);
        setContentView(R.layout.main);

        RevMob revmob = RevMob.start(this, REVMOB_APP_ID);
        RevMobAdsListener listener = new RevMobAdsListener() {
            public void onRevMobAdReceived() { Log.i("[RevMob]", "onAdReceived"); }
            public void onRevMobAdNotReceived(String message) {} // you can create an workaround here
            public void onRevMobAdDisplayed() {}
            public void onRevMobAdDismiss() {}
            public void onRevMobAdClicked() {}
        };
        RevMobLink link = revmob.openAdLink(this, listener);
    }
}

A good idea is to pre-load the link.

import com.revmob.ads.banner.RevMobLink;

public class YourActivity extends Activity {
    private RevMobLink link;

    public void onResume(Bundle savedInstanceState) {
        super.onResume(savedInstanceState);
        setContentView(R.layout.main);

        RevMob revmob = RevMob.start(this, REVMOB_APP_ID);
        RevMobAdsListener listener = new RevMobAdsListener() {
            public void onRevMobAdReceived() { Log.i("[RevMob]", "onAdReceived"); }
            public void onRevMobAdNotReceived(String message) {} // you can hide the More Games Button here
            public void onRevMobAdDisplayed() {}
            public void onRevMobAdDismiss() {}
            public void onRevMobAdClicked() {}
        };
        link = revmob.createAdLink(this, listener);

        Button buttonMoreGames; // instantiate it
        buttonMoreGames.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                link.open();
            }
        });
    }
}

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 ad unit.

public class YourActivity extends Activity {
    public void onResume(Bundle savedInstanceState) {
        super.onResume(savedInstanceState);
        setContentView(R.layout.activity_main);

        RevMob revmob = RevMob.start(this, REVMOB_APP_ID);
        revmob.showPopup(this);
    }
}
import com.revmob.ads.popup.RevMobPopup

public class YourActivity extends Activity {
    private RevMobPopup popup;

    public void onResume(Bundle savedInstanceState) {
        super.onResume(savedInstanceState);
        setContentView(R.layout.activity_main);

        RevMob revmob = RevMob.start(this, REVMOB_APP_ID);
        popup = revmob.createPopup(this); // pre-load it without showing it
    }

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

Listeners - Delegates

With Listeners (also known as Delegates or Callbacks) you can follow the ad workflow. The RevMob SDK will fire events for every important change in the ad state. For example, you can identify if the ad was loaded successfully or you can identify if the user clicked in the ad.

To use listeners, you must create a concrete class that implements the RevMobAdsListener interface. This class can be anonymous, like the following one:

RevMobAdsListener revmobListener = new RevMobAdsListener() {
    @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 onRevMobAdDismiss() {
        Log.i("[RevMob]", "onAdDismiss");
    }

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

After, you must pass an instance of the listener to the RevMob methods:

// each ad unit instance can have its own and independent listener
revmob.createFullscreen(this, revmobListener);
revmob.createAdLink(this, revmobListener);
revmob.createBanner(this, revmobListener);
revmob.createPopup(this, revmobListener);

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 App 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.createAdLink(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, send us a message clicking in the Contact Us link in the RevMob Web Site. To accelerate the response of our team, please, attach 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 - 6.8.3

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)

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 App 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 App 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 App 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 App 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.