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

Take a look at Start Session section in order to understand its implementation.

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

The first point that has to be clear is that RevMob use IDFA! So, check "Yes" for the option in the right side of the page.

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

EULA

From now on, RevMob MAY present our "End User Licence Agreement (EULA)" to every Android end user. It will be shown as a popup when the app first starts the session. The popup will show two buttons: "I agree" and "I don't agree".

If the user presses "I agree", the EULA will only be shown again when its version changes.

If he presses "I don't agree", the app will be closed. Then, the EULA will be presented again when the user opens the app, until the agreement.

Configuration

Access the RevMob Console and register your application to get your Media ID;

unity1

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

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

You can use the RevMob SDK for iOS and Android applications, but be aware about some differences for each platform:

iOS

storekit

Android

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

Google Advertising ID

RevMob will now start to use Google Advertising ID, provided by Google Play Services. In order to implement it in your app, follow these instructions:

  <meta-data android:name="com.google.android.gms.version"
             android:value="@integer/google_play_services_version" />
-keep class * extends java.util.ListResourceBundle {
    protected Object[][] getContents();
}

-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
    public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
    @com.google.android.gms.common.annotation.KeepName *;
}

-keepnames class * implements android.os.Parcelable {
    public static final ** CREATOR;
}

Start Session

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

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 APP_IDS = new Dictionary.<String, String>();
APP_IDS["Android"] = "copy your Android RevMob Media ID here";
APP_IDS["IOS"] = "copy your iOS RevMob Media ID here";
private var revmob:RevMob;

function Awake() {
    revmob = RevMob.Start(APP_IDS, "Your GameObject name");
}

Testing Mode

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

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!

        
    

Fullscreen

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

public class GameObject : MonoBehaviour {
    void Start() {
        revmob.ShowFullscreen();
    }
}
<application>
    <activity
            android:name="com.revmob.ads.fullscreen.FullscreenActivity"
            android:configChanges="keyboardHidden|orientation" >
    </activity>
</application>

Banner

public class GameObject : MonoBehaviour {
    void Start() {
        #if UNITY_ANDROID || UNITY_IPHONE
            RevMobBanner banner = revmob.CreateBanner();
            banner.Show();
        #endif
    }
}
#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>

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.

public class GameObject : MonoBehaviour, IRevMobListener {
    void OnGUI() {
        if( GUI.Button(new Rect(0, 0, 320, 50), "Download a Free Game") ) {
            revmob.OpenAdLink();
        }
    }
}
public class GameObject : MonoBehaviour, IRevMobListener {
    private RevMobLink link;

    public void Start() {
        link = revmob.CreateAdLink();
    }

    void OnGUI() {
        if( GUI.Button(new Rect(0, 0, 320, 50), "Download a Free Game") ) {
            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.

revmob.ShowPopup();

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 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 RevMobGameObject : MonoBehaviour, IRevMobListener {
    private RevMob revmob;

    public void Awake() {
        revmob = RevMob.Start(appIds, "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 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(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 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.

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

Download

Download unity - 7.4.1

Requirements

Unity 3.5.6+

Change Log (yyyy/mm/dd)

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.