RevMob Unity SDK

Configuration

OBS: Requires Unity 3.5.6+

unity1

Be aware to test only in devices, using Android APK files or generated XCode projects. The ads will not be shown in Unity editor or XCode simulators.

To build locally, check "Development Build".

You can integrate RevMob Unity SDK using C# or Javascript.

You can use the RevMob SDK for iOS and Android applications, but be aware that there are some differences for each platform.

iOS

To build iOS for Unity 5, you need to disable ARC on RevMobUnityiOSBinding.m.

Disabling it through Unity: Find it on Assets/Plugins/iOS and click on it. In the Inspector, Platform settings, find Compile flags, add -fno-objc-arc and Apply.

Disabling it through Xcode: Click on your project and go to Build Phases. Under "Compile Sources", double click on RevMobUnityiOSBinding.m and add the Compiler Flag -fno-objc-arc.

On Xcode:

storekit

Android

If you don't already have an AndroidManifest.xml file, build your project for Android to generate it.

<!-- Required -->
<uses-permission android:name="android.permission.INTERNET"/>
<application>
    <activity android:name="com.revmob.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, i.e. initialize our SDK.

It's a best practice to do that as soon as your app is ready, so you can call ads easily whenever you want to.

To start using RevMob for Unity, you need to instantiate the RevMob instance in accordance to the deploy device. A good place to start it is in the Awake() method of your GameObject:

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameObject : MonoBehaviour {
    private static readonly Dictionary<String, String> REVMOB_APP_IDS = new Dictionary<String, String>() {
        { "Android", "copy_your_Android_RevMob_Media_ID_here"},
        { "IOS", "copy_your_iOS_RevMob_Media_ID_here" }
    };
    private RevMob revmob;

    void Awake() {
        revmob = RevMob.Start(REVMOB_APP_IDS, "Your_GameObject_name");
    }
}
import System.Collections.Generic;

private var REVMOB_APP_IDS = new Dictionary.<String, String>();
REVMOB_APP_IDS["Android"] = "copy_your_Android_RevMob_Media_ID_here";
REVMOB_APP_IDS["IOS"] = "copy_your_iOS_RevMob_Media_ID_here";
private var revmob:RevMob;

function Awake() {
    revmob = RevMob.Start(REVMOB_APP_IDS, "Your_GameObject_name");
}

Testing Mode

While you are developing your app, you will only receive test ads

Once you're finished, and your app is in the store with our SDK, you should register your media clicking in the Go Live! button in our Medias page

golive

After clicking it, a pop up will appear. Paste the url for your app's store page.

goliveurl

Your app will be live and it will start to receive real ads.

Uploading App to AppStore

When uploading your app to AppStore with RevMob SDK, you will be asked about the use of IDFA.

app_store_idfa

RevMob uses IDFA for targeting purposes. You should check "Yes" on the option at the right side of the page, as it will improve a lot your earnings.

Then, on the last three checkboxes:

Native Button

Native Button ads are the easiest to implement, the ones with highest eCPM and the ones that fit most your app.

You can use them in 2 different ways:

Button implementation

The advantage of the RevMob Button implementation is that there is no need to write any extra code, you can just include the button in your XML file:

Take a look at the GUI.Button documentation to better customize the button to your app.

    void Awake() {
        revmob = RevMob.Start(REVMOB_APP_IDS, "Your_GameObject_name");
    }

    void Start() {
        if( GUI.Button(new Rect(0, 0, 320, 50), "More Games") ) {
            revmob.OpenButton();
        }
    }

To get better eCPMs, edit its layout to best fit your app's.

Keep in mind that the button must be clearly identified as an advertising.

Link implementation

Though internally it's almost the same case, the advantage of the RevMob Link is that you have full control over its layout, it doesn't have to be a button.

Just call the OpenLink method and implement the IRevMobListener interface.

public class GameObject : MonoBehaviour, IRevMobListener {
    void onYourButtonClicked() {
        revmob.OpenLink();
    }
}

Keep in mind that the image associated with this link must be clearly identified as an advertising.

Fullscreen

Fullscreen is an advertising that occupies the whole screen of the device. It's usually shown:

With SDK 9 our fullscreen ad unit can show either an interstitial or a video ad. It will always return the best campaign for your app. This will only happen though if you call createFullscreen and show it after the RevMobAdReceived listener is called.

If you want to display only interstitial ads in your app, uncheck “Accepts Video” in our console (select your app, scroll down to Ad Units and click on "Actions" button).

    revmob.ShowFullscreen();

Make sure to call it only after RevMob's session is started. You can do that by checking if revmob object has been created or through RevMob's listeners.

For Android it's required to add RevMob activity in AndroidManifest.xml. Just add the following code in application node:

<application>
    <activity
            android:name="com.revmob.FullscreenActivity"
            android:configChanges="keyboardHidden|orientation" >
    </activity>
</application>

Banner

    RevMobBanner banner = revmob.CreateBanner();
    banner.Show();
#if UNITY_ANDROID || UNITY_IPHONE
    banner.Hide();
    banner.Release();
    banner = null;
#endif
// Definition
#if UNITY_ANDROID
    RevMob.CreateBanner(RevMob.Position position, int x, int y, int w, int h);
#elif UNITY_IPHONE
    RevMob.CreateBanner(float x, float y, float width, float height, string placementId, ScreenOrientation[] orientations);
#endif

// Example
#if UNITY_ANDROID
    banner = revmob.CreateBanner(RevMob.Position.TOP, 0, 0, 350, 50);
    banner.Show();
#elif UNITY_IPHONE
    banner = revmob.CreateBanner(0, 0, 350, 50, null, null);
    banner.Show();
#endif

If you are using Unity 4.5 or above, put that flag in the UnityPlayerNativeActivity:

    <activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
      <meta-data android:name="android.app.lib_name" android:value="unity" />
      <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
    </activity>

If you are using Unity 4.3, put that flag in the UnityPlayerProxyActivity:

    <activity android:name="com.unity3d.player.UnityPlayerProxyActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
    </activity>

If you are using Unity 4.2 or bellow, put that flag in the UnityPlayerNativeActivity:

    <activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
      <meta-data android:name="android.app.lib_name" android:value="unity" />
      <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
    </activity>

Video

Only supported by SDK version 9 or later.

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

It is mandatory to call the createVideo method before the showVideo. A good place to do that is after the startSession.

    public class GameObject : MonoBehaviour {
        void Start() {
            revmob.CreateVideo();
        }
    } 

The ad can only be shown after it was completely downloaded. To do that, you should implement RevMob listeners:

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.

It is mandatory to call the CreateRewardedVideo method before the ShowRewardedVideo. A good place to do that is after the startSession.

    public class GameObject : MonoBehaviour {
        void Start() {
            revmob.CreateRewardedVideo();
        }
    } 

The rewarded video can only be shown after it was completely downloaded. To do that, you should implement RevMob listeners:

You can give the reward once one of these listeners are fired:

        public void RewardedVideoCompleted() {
            Debug.Log("RevMob Rewarded Video completed. You earned a coin!");
        }

        public void UserClickedInTheAd(string revMobAdType) {
            Debug.Log("Ad clicked. You earned a coin!");
        }

Rewarded video is not clickable nor skippable on the first time it's being watched.

All Rewarded Video's specific listeners:

    public void RewardedVideoLoaded() {
        Debug.Log(">>> RewardedVideoLoaded");
    }
    public void RewardedVideoNotCompletelyLoaded() {
        Debug.Log(">>> RewardedVideoNotCompletelyLoaded");
    }
    public void RewardedVideoStarted() {
        Debug.Log(">>> RewardedVideoStarted");
    }
    public void RewardedVideoFinished() {
        Debug.Log(">>> RewardedVideoFinished");
    }
    public void RewardedVideoCompleted() {
        Debug.Log(">>> RewardedVideoCompleted");
    }
    public void RewardedPreRollDisplayed() {
        Debug.Log(">>> RewardedPreRollDisplayed");
    }

Event Listeners

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.

To pass a GameObject to receive a callback message from RevMob ads, you must implement the interface IRevMobListener. Follow the example below (note that it includes start session and EULA listeners):

public class GameObject : MonoBehaviour, IRevMobListener {
    private RevMob revmob;

    public void Awake() {
        revmob = RevMob.Start(REVMOB_APP_IDS, "Your_GameObject_name");
    }

    #region IRevMobListener implementation
    public void SessionIsStarted () {
        Debug.Log("Session started.");
    }

    public void SessionNotStarted (string revMobAdType) {
        Debug.Log("Session not started.");
    }

    public void AdDidReceive (string revMobAdType) {
        Debug.Log("Ad did receive.");
    }

    public void AdDidFail (string revMobAdType) {
        Debug.Log("Ad did fail.");
    }

    public void AdDisplayed (string revMobAdType) {
        Debug.Log("Ad displayed.");
    }

    public void UserClickedInTheAd (string revMobAdType) {
        Debug.Log("Ad clicked.");
    }

    public void UserClosedTheAd (string revMobAdType) {
        Debug.Log("Ad closed.");
    }



    public void RewardedVideoLoaded () {
        Debug.Log("RewardedVideoLoaded.");
    }

    public void RewardedVideoNotCompletelyLoaded () {
        Debug.Log("RewardedVideoNotCompletelyLoaded.");
    }

    public void RewardedVideoStarted () {
        Debug.Log("RewardedVideoStarted.");
    }

    public void RewardedVideoFinished () {
        Debug.Log("RewardedVideoFinished.");
    }

    public void RewardedVideoCompleted () {
        Debug.Log("RewardedVideoCompleted.");
    }

    public void RewardedPreRollDisplayed () {
        Debug.Log("RewardedPreRollDisplayed.");
    }



    public void VideoLoaded () {
        Debug.Log("VideoLoaded.");
    }

    public void VideoNotCompletelyLoaded () {
        Debug.Log("VideoNotCompletelyLoaded.");
    }

    public void VideoStarted () {
        Debug.Log("VideoStarted.");
    }

    public void VideoFinished () {
        Debug.Log("VideoFinished.");
    }



    public void InstallDidReceive(string message) {
        Debug.Log("Install received");
    }

    public void InstallDidFail(string message) {
        Debug.Log("Install not received");
    }

    public void EulaIsShown() {
            Debug.Log("Eula is displayed");
    }

    public void EulaAccepted() {
            Debug.Log("Eula was accepted");
    }

    public void EulaRejected() {
            Debug.Log("Eula was rejected");
    }
    #endregion
}
private var revmob:RevMob;

function Awake() {
  revmob = RevMob.Start(REVMOB_APP_IDS, "Your_GameObject_name");
}

function SessionIsStarted(adUnitType) {
    Debug.Log("Session started.");
}

function SessionNotStarted(adUnitType) {
    Debug.Log("Session not started.");
}

function AdDidReceive(adUnitType) {
    Debug.Log("Ad did received");
}

function AdDidFail(adUnitType) {
    Debug.Log("Ad did not received");
}

function AdDisplayed(adUnitType) {
    Debug.Log("Ad displayed");
}

function UserClickedInTheAd(adUnitType) {
    Debug.Log("Ad clicked");
}

function UserClosedTheAd(adUnitType) {
    Debug.Log("Ad closed");
}

function EulaIsShown(adUnitType) {
    Debug.Log("Eula is displayed");
}

function EulaAccepted(adUnitType) {
    Debug.Log("Eula was accepted");
}

function EulaRejected(adUnitType) {
    Debug.Log("Eula was rejected");
}

Placement IDs

Placement ID is a way to control how ads perform in different parts of your app and select which of them will be running in real time, without any update to your code.

To begin with, take a look at our console under Media Details page. Scroll down and you'll find your default advertising placements (ad units). You can create new ones and name them properly (e.g. "Game Over").

To get its ID, click on the "eye" button on its row and find it right below its name on Placement Details page.

You can then put as many ad units as you want throughout your app and control which ones are running via console, based on how each of them is performing.

When you turn an ad unit "off", it simply won't receive any ad (you can test how ads behave when they don't receive ads turning testing mode on "without ads").

revmob.ShowFullscreen(REVMOB_PLACEMENT_IDS_FULLSCREEN);

Timeout

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

revmob.SetTimeoutInSeconds(5);

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

Advertisement - Install Report

RevMob SDKs can be used by advertisers who want to report the installation of the advertised app. It only requires starting RevMob session.

Download

Download unity - 9.0.6


Change Log (yyyy/mm/dd)

9.0.6 (2015/11/17)

  • New AdUnit Link has been improved and is now faster.
  • Bugfix Fixed issue that was causing Banners to not report impressions.
  • Update Internal improvements.

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.1 (2015/05/28)

  • Bugfix Updated Android and iOS binaries with fixes.

9.0.1 (2015/05/28)

  • Bugfix Updated Android and iOS binaries with fixes.

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.5.0 - 2015/04/07

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

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

7.4.1 - 2014/11/04

  • NewUpdate Support to iOS 8.1

7.4.0 - 2014/09/09

  • NewUpdate Support to iOS 8.0.1 (fullscreen now supports video ads)

7.3.2 - 2014/07/10

  • ImportantUpdate iOS Banner dimensions are not limited anymore. Logs inform if they are smaller than the expected.
  • ImportantUpdate Android Banner dimensions are not limited anymore.
  • 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.

7.3.1 - 2014/05/15

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

7.3.0 - 2014/05/14

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

7.2.7 - 2014/04/10

  • ImportantBugfix Fixes last remaining bugs on iOS that could lead to "SESSION NOT STARTED" warning.

7.2.6 - 2014/04/03

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

7.2.5 - 2014/03/13

  • UpdateImportant Fixes a bug on iOS that was preventing some apps to be approved at AppStore.
  • Bugfix iOS fullscreen and banner were not preserving app supported orientations.
  • New Preload button for banner in Sample App.

7.2.4 - 2014/02/17

  • UpdateImportant Important internal improvements for iOS releases.

7.2.3 - 2014/02/14

  • UpdateImportant Important internal improvements for iOS releases.

7.2.2 - 2014/02/14

  • NewImportant Changed the plugin structure (new revmob folder).

7.2.1 - 2013/12/18

  • Bugfix iOS 7 banner crash.

7.2.0 - 2013/12/17

  • New Preload banner for Android.

7.1.2 - 2013/11/04

  • Bugfix Android banner crash when rotate the device.

7.1.1 - 2013/10/29

  • Bugfix Android banner position.

7.1.0 - 2013/10/24

  • update Banner for Android improved and with more options for position and resize.
  • Update Important internal improvements for Android releases.
  • Update Important internal improvements for iOS releases.

7.0.1 - 2013/09/26

  • New Sample App project added to the SDK.

7.0.0 - 2013/09/18

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

6.3.0 - 2013/08/27

  • New Fullscreen animations.
  • Delete Notification removed to respect the new Google policy.

6.2.5 - 2013/08/06

  • Bugfix iOS build issue.

6.2.4 - 2013/08/01

  • Update Important internal improvements for iOS releases.

6.2.3 - 2013/07/24

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

6.2.2 - 2013/07/19

  • Bugfix Banner issue on iOS.

6.2.1 - 2013/07/18

  • New Banner for Android.
  • Update Important internal improvements for Android releases.

6.2.0 - 2013/05/23

  • Update Important internal improvements for Android releases.
  • Update Important internal improvements for iOS releases.
  • Optimization Using less memory in Android fullscreen.
  • Bugfix Banner in iOS can now be in the 0,0 position.

6.1.0 - 2013/04/10

  • Update- Important This version no longer send the UDID in iOS platform, according to the new Apple rules (More info).
  • Delete Method isLoaded was removed from all ad units for iOS and Android.

6.0.0 - 2013/02/27

  • New Internal improvements that implicates in better statistics management in the RevMob console.
  • Bugfix RevMobIosLink is now public.

5.0.2 - 2013/02/21

  • Update Important internal improvements for iOS releases.

5.0.1 - 2013/01/30

  • Update Important internal improvements for Android releases.

5.0.0 - 2013/01/21

  • New Custom timeout for Android and iOS.
  • New Notification ad for Android.
  • New Option to customize banner size and position for iOS.
  • New- Important New way to set the testing mode.
  • Update- Important Added RevMob prefix in all SDK objects. Banner renamed to RevMobBanner, Fullscreen renamed to RevMobFullscreen, Popup renamed to RevMobPopup. AdLink renamed to RevMobLink.
  • Bugfix Backing out printEnvironmentInformation method.

4.4.1 - 2012/11/09

  • New Changed Link to allow preload the ad.
  • New CreateAdLink method.

4.3.0 - 2012/10/19

  • New Support to armv6 for iOS builds.
  • New Added support to placements.

4.2.2 - 2012/10/05

  • Update Memory management improvement for iOS.
  • Bugfix Fixed callback names in android.
  • Bugfix Avoid app crash when gameObjectName is null.

4.2.0 - 2012/10/04

  • New Sends callback message to a GameObject.
  • New Open itunes in app (iOS).
  • New Supports armv7s.

4.1.1 - 2012/09/18

  • New Sending sdk name and version.

4.1.0 - 2012/09/14

  • New Added testing mode for iOS and Android.

4.0.1- 2012/08/27

  • Update Can be used in unity editor.

4.0.0 - 2012/08/24

  • New RevMobAndroid and RevMobIOS objects.
  • Update revmob-ios-sdk and revmob-android-sdk to the newest versions.

3.0.1 - 2012/08/09

  • New Method for print environment information: RevMob.PrintEnvironmentInformation(REVMOBAPPID).

3.0.0 - 2012/08/09

  • New Method startSession is now mandatory. There are significant chances in the facade (only the startSession method requires the Media ID).
  • New Now it is possible to use the RevMob SDK in Unity-JavaScript too.
  • New (iOS) feature to deactivate banner.
  • New (Android) Fullscreen is now an Activity.
  • New (Android) Open advertisements in Amazon App Store for Amazon Campaigns (not yet implemented in server).
  • OptimizationBugfix Using RevMob iOS SDK to version 3.0.0.
  • OptimizationBugfix Using RevMob Android SDK to version 3.5.0.

1.6.2 - 2012/07/19

  • Update iOS sdk to version 2.0.6
  • Update android sdk to version 3.2.6

1.6.1 - 2012/07/18

  • Update Android sdk to version 3.2.5.

1.6.0 - 2012/07/10

  • New Now it is possible to customize orientations for banner and fullscreen for iOS.
  • New Delegate methods for iOS.
  • New Fullscreen with pre-load for Android.

1.5.0 - 2012/07/03

  • New Added a Ad Link for iOS.
  • Update Fullscreen and banner for iOS now only rotates to orientation defined in the shouldAutorotateToInterfaceOrientation of the rootViewController.
  • Bugfix Fullscreen rotation for iOS is now working for iOS 4 too.

1.4.5 - 2012/07/02

  • Update Changed polish fullscreen translation.

1.4.4 - 2012/06/29

  • New Fullscreen with pre-load for iOS.
  • New Ad Link for Android.

1.4.3 - 2012/06/28

  • Update Better log messages for iOS.

1.4.2 - 2012/06/28

  • Update Internal improvements in the Fullscreen ad.

1.4.1 - 2012/06/27

  • Optimization Better iOS memory management.
  • Delete Fullscreen with pre-load for Android.

1.4.0 - 2012/06/25

  • New Banner advertisement for iOS.

1.3.2 - 2012/06/21

  • Update Renamed iOS headers to avoid conflicts.

1.3.1 - 2012/06/20

  • New Fullscreen for iOS has modal behavior.

1.3.0 - 2012/06/18

  • New Fullscreen without loading timefor iOS.
  • New Fullscreen without loading timefor Android.
  • Delete Fullscreen with pre-load for iOS.

1.2.0 - 2012/06/13

  • New Fullscreen with pre-load for iOS.

1.1.0 - 2012/06/09

  • New Fullscreen for iOS.

1.0.1 - 2012/06/07

  • New isAdLoaded method for fullscreen.
  • New Popup Ad for iOS and Android.
  • New Fullscreen Ad for Android.