RevMob Cordova 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.

Uploading App to AppStore

When uploading your app to AppStore using RevMob SDK, you will be asked about the use of IDFA, according to the image below.

app_store_idfa

RevMob uses IDFA for targeting purposes. So, checking "Yes" for the option in the right side of the page will improve a lot your earnings.

Then, for the three checkboxes at the bottom, here is what you have to do:

Configuration

or through Cordova Plugins Website.

phonegap create HelloWorld && cd HelloWorld cordova plugin add https://github.com/RevMob/cordova-plugin Then copy the index.html file from the plugin's example folder to HelloWorld/www/

Creating a new PhoneGap project (Outdated info)

Start Session

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

<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
    <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
    <script type="text/javascript" charset="utf-8" src="revmob.js"></script>
    <script type="text/javascript" charset="utf-8">
        var revmob = null;
        function onDeviceReady() {
            revmob = new RevMob("copy your RevMob Media ID here");
        }

        function onBodyLoad() {
            document.addEventListener("deviceready", onDeviceReady, false);
        }
    </script>
</head>
<body onLoad="onBodyLoad()">
</body>
</html>

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!

        
    

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 ... //
}
    this.loadRewardedVideo = function(successCallback, errorCallback) {
        cordova.exec(successCallback, errorCallback, "RevMobPlugin", "loadRewardedVideo", []);
    }

    this.showRewardedVideo = function(successCallback, errorCallback) {
        cordova.exec(successCallback, errorCallback, "RevMobPlugin", "showRewardedVideo", []);
    }

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

p

    this.loadVideo = function(successCallback, errorCallback) {
        cordova.exec(successCallback, errorCallback, "RevMobPlugin", "loadVideo", []);
    }
this.showVideo = function(successCallback, errorCallback) {
        cordova.exec(successCallback, errorCallback, "RevMobPlugin", "showVideo", []);
    }

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 ... //
}


    this.loadFullscreen = function(successCallback, errorCallback) {
        cordova.exec(successCallback, errorCallback, "RevMobPlugin", "loadFullscreen", []);
    }

    this.showLoadedFullscreen = function(successCallback, errorCallback) {
        cordova.exec(successCallback, errorCallback, "RevMobPlugin", "showLoadedFullscreen", []);
    }
    this.showFullscreen = function(successCallback, errorCallback) {
        cordova.exec(successCallback, errorCallback, "RevMobPlugin", "showFullscreen", []);
    }

Banner

Only the banner basic usage is currently available.

revmob.showBanner(null, null);
revmob.hideBanner(null, null);

Button

<button onclick="revmob.openButton(onSuccess, onError);">Open Button</button>

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.

revmob.openLink(null, null);

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.

revmob.showPopup(null, null);

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 if the user clicked on the ad.

var successCallback = function (event) {
    var message = "";
    if (event.RevMobAdsEvent == "SESSION_STARTED") {
        message = "Session started!";
    }
    else if (event.RevMobAdsEvent == "AD_RECEIVED") {
        message = "Ad received!";
    }
    else if (event.RevMobAdsEvent == "AD_DISMISSED") {
        message = "Ad dismissed!";
    }
    else if (event.RevMobAdsEvent == "AD_CLICKED") {
        message = "Ad clicked!";
    }
    else if (event.RevMobAdsEvent == "AD_DISPLAYED") {
        message = "Ad displayed!";
    }
    else if (event.RevMobAdsEvent == "VIDEO_LOADED") {
        message = "Video loaded!";
    }
    else if (event.RevMobAdsEvent == "VIDEO_NOT_COMPLETELY_LOADED") {
        message = "Video not completely loaded!";
    }
    else if (event.RevMobAdsEvent == "VIDEO_STARTED") {
        message = "Video started!";
    }
    else if (event.RevMobAdsEvent == "VIDEO_FINISHED") {
        message = "Video finished!";
    }
    else if (event.RevMobAdsEvent == "REWARDED_VIDEO_LOADED") {
        message = "Rewarded Video loaded!";
    }
    else if (event.RevMobAdsEvent == "REWARDED_VIDEO_NOT_COMPLETELY_LOADED") {
        message = "Rewarded Video not completely loaded!";
    }
    else if (event.RevMobAdsEvent == "REWARDED_VIDEO_STARTED") {
        message = "Rewarded Video started!";
    }
    else if (event.RevMobAdsEvent == "REWARDED_VIDEO_FINISHED") {
        message = "Rewarded Video finished!";
    }
    else if (event.RevMobAdsEvent == "REWARDED_VIDEO_COMPLETED") {
        message = "Rewarded Video completed!";
    }
    else if (event.RevMobAdsEvent == "REWARDED_PRE_ROLL_DISPLAYED") {
        message = "Rewarded Video Pre-Roll displayed!";
    }
    else {
        message = event.RevMobAdsEvent;
    }
}

var errorCallback = function (event) {
    var message = "";
    if (event.RevMobAdsEvent == "AD_NOT_RECEIVED") {
        message = "Ad not received!";
    }
    else if (event.RevMobAdsEvent == "SESSION_NOT_STARTED") {
        message = "Session not started!";
    }
    else {
        message = event.RevMobAdsEvent;
    }
}

revmob.showFullscreen(successCallback, errorCallback);
revmob.openLink(successCallback, errorCallback);
revmob.showPopup(successCallback, errorCallback);

Timeout

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

revmob.setTimeoutInSeconds(5);

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.printEnvironmentInformation();

Change Log (yyyy/mm/dd)

9.0.4 (2015/09/01)

  • New Added RevMob Button ad unit.
  • Bugfix Fixes an important issue affecting part of the clicks, lowering the eCPM.
  • Important Many internal improvements and performance enhances.

9.0.2 (2015/06/17)

  • Important Updated the SDK to follow Cordova's plugin structure

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.

1.4.2 - 2015/04/07

  • Important Added x86_64 architecture support due to Apple's new requirement.
  • New Added refreshable banners.

1.3.4 - 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

1.3.3 - 2014/11/05

  • NewImportantUpdate Added support to iOS 8.1
  • ImportantUpdate Internal improvements for both iOS and Android.

1.3.2 - 2014/09/10

  • NewImportantUpdate iOS Video Ads support.
  • NewImportant Android L compatibility.
  • NewImportant iOS 8 compatibility.

1.3.1 - 2014/07/10

  • ImportantUpdate iOS Banner dimensions are not limited anymore. Logs inform if they are smaller than the expected.
  • ImportantBugfix iOS Banner was being shown in front of the keyboard.
  • NewImportant Support for Google ID for Advertisement (details)
  • NewImportant New listeners for Eula popup window (details) for Android
  • NewImportant New public methods for accepting and rejecting the Eula programmatically - ONLY for testing purposes (details) for Android
  • NewImportant New listeners for start session in iOS and Android (documentation).
  • ImportantBugfix In iOS, status bar was being shown even if the app was hiding it.
  • ImportantUpdate Internal improvements.

1.3.0 - 2014/06/11

  • Update Internal improvements for Android releases.
  • Update Internal improvements for iOS releases.

1.2.2 - 2014/04/10

  • ImportantBugfix Fixes a bug that could lead to "SESSION NOT STARTED" warning.

1.2.1 - 2014/02/19

  • Update Internal improvements for Android releases.
  • Update Internal improvements for iOS releases.

1.2.0 - 2013/11/13

  • New Banners are now available but with limited options.
  • Update Internal improvements for Android releases.
  • Update Internal improvements for iOS releases.

1.1.0 - 2013/10/04

  • New The listener returns what was the event (received, displayed, clicked, dismiss and not received).

1.0.0 - 2013/09/19

  • NewImportant Support to iOS 7 GM (arm64 architecture are not supported yet).
  • Important Dropped support to iOS 4.
  • Update Important internal improvements for Android releases.
  • Update Important internal improvements for iOS releases.

0.6.1 - 2013/09/11

  • Update Reduced sample app size.

0.6.0 - 2013/08/12

  • Update Cordova SDK 3.0.0.

0.5.2 - 2013/08/01

  • Update Important internal improvements for iOS releases.

0.5.1 - 2013/07/25

  • Update Important internal improvements for Android releases.
  • Update Important internal improvements for iOS releases.

0.5.0 - 2013/05/29

  • Update Important internal improvements for Android releases.
  • Update Important internal improvements for iOS releases.
  • Optimization Using less memory in Android fullscreen.

0.4.1 - 2013/04/09

  • NewImportant iOS UDIDs are not collected anymore (More info).
  • Update Improvement on the logs.
  • Update Lots of internal improvements that will increase the eCPM significantly.
  • Update Android permissions validations (logs to alert implementation issues).
  • Bugfix Fixed an issue that can cause a click to fail on fullscreen.
  • Bugfix Fixed some issues that can prevent the notification of errors clicks.
  • Bugfix Fixed some issues that can cause memory leaks.

0.4.0 - 2013/02/27

  • New Using cordova 2.4.0.
  • New Ad Link for Android and iOS: revmob.openAdLink();
  • New Custom timeout for Android and iOS: revmob.setTimeoutInSeconds(5);
  • New Print Environment Informtion for Android and iOS: revmob.printEnvironmentInformation();
  • UpdateImportant New testing mode: revmob.setTestingMode(revmob.TEST_WITH_ADS); revmob.setTestingMode(revmob.TEST_WITHOUT_ADS);
  • Update Improvements in Android and iOS sample apps.

0.3.0 - 2012/11/30

  • New Using cordova 2.2.0.
  • Update RevMobPlugin210 class to keep compatibility with older versions of Cordova/PhoneGap.
  • Update Improvements in Android and iOS sample apps.

0.2.0 - 2012/11/19

  • Bugfix Avoid null pointer exception on create Fullscreen activity.
  • Bugfix Fixed error on click pop up.

0.1.5 - 2012/10/08

  • New Added sample android app.

0.1.5 - 2012/10/08

  • New Added support to iphone simulator.