Integration Guides


Xamarin

Full Guide

Getting Started

Ad Unit

Advanced

SDK Package

Android iOS

1 Overview

It takes 4 simple steps to start monetizing:

  1. Add your app to our system and get your App ID.
  2. Add the component to your project
  3. Implement the Init method and the Ad Unit you wish to use: Native Ads, Link, Interstitial, Banner and/or Rewarded Video
  4. Apply to receive live ads
media_id

2 Configuration

Our Xamarin Component is really simple to integrate:
Check the official Xamarin documentation

3 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.
In your index.html file, inside www folder, put the following code.

Implementation


Rm.Init(currentActivity, REVMOB_APP_ID);
            

Revmob.InitWithAppId(NSObject.FromObject(REVMOB_APP_ID));
            

4 Kids Category

Apps designed for kids have special regulations for monetizing. As stated in Apple's guidelines, they may not include behavioral advertising and the ads must be appropriate for kids.
Revmob is fully COPPA compliant. To specify that your app is designed for kids and to guarantee that it's fully compliant, you must set the user minimum age when your user is 13 or less years old:


Rm.SetUserAgeMin(NSObject.FromObject("10"));
            

Revmob.SetUserAgeMin(NSObject.FromObject("10"));
            

Attention:
This method is only to protect children from abusive advertising, setting the user age incorrectly may affect your eCPM due to our algorithms that uses this information for retargeting.

5 Upload to App Store

When uploading your app to App Store with Revmob SDK, you will be asked about the use of IDFA.
Revmob uses IDFA for targeting purposes. Check "Yes" on the option at the right side of the page, as it will improve your earnings a lot.
Then, on the last three checkboxes:

  1. Check this box to serve ads.
  2. Check this box if you are also advertising the app you are uploading, and its installations will be tracked.
  3. This check is optional, as it's not used by Revmob.
app_store_idfa

6 Sample App

Our component comes with a Sample Application that demonstrates how to display different ads using Revmob.

Build Requirements

  • Android SDK platform for Android 4.0 (API level 14).
  • The minimum required version is OS X Yosemite (10.10)
  • XCode 7.2.
  • iOS 7.0.

7 Testing

While you're developing your app, you will only receive test ads. Your app must make at least one ad request while on test mode in order to be validated before receiving live ads. Be sure you are able to receive at least one of our sample ads and that it’s redirecting to our "Success Page" when clicked. Once you are able to receive our sample ads it means you’ve successfully integrated our sdk.

sample_ads

Fullscreen sample, Banner sample, and Success Page

8 Go Live

Once you're finished and your app is in the store with our SDK, click on the "Go live" button in your Apps page and insert your app's URL. It may take up to 48h for your app to be approved. After that, it will start receiving live ads.

app_store_idfa

1 Link

You have full control over this ad unit's layout. You design it, attach our method to its click event and the user will be redirected to the Play Store.
A common usage is to associate it to a "more games" button or to a custom banner your team designed.
Keep in mind that the image associated with this link must be clearly identified as an advertising.

You can call the CacheLink method like this:


Revmob.CacheLink(NSObject.FromObject(REVMOB_PLACEMENT_ID));
            

You can call the CacheLink method like this:


Rm.CacheLink(REVMOB_PLACEMENT_ID, cacheLinkAdListener);
            

You can also simply call its OpenLink method when clicked:


Rm.OpenLink(currentActivity, REVMOB_PLACEMENT_ID, openLinkAdListener);
            

You can also simply call its OpenLink method when clicked:


Revmob.OpenLink(NSObject.FromObject(REVMOB_PLACEMENT_ID));
            

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

ant_smasher_native

100-million-downloads Ant Smasher's success case.

2 Interstitial

The Interstitial is an advertisement that fills the whole screen. It's usually shown:

  1. On app start;
  2. Before/after a game round;
  3. After a service is used (e.g. alarm turned off).

When pre-caching, the ad received can either be a static interstitial or a video ad. Our servers will always return the one that can pay you more.

Don't forget to declare Revmob's RmInterstitial on your AndroidManifest.xml file inside your <Application> tags:




            

You can call the CacheInterstitial method like this:


Rm.CacheInterstitial(REVMOB_PLACEMENT_ID, cacheInterstitialAdListener);            
            

Revmob.CacheInterstitial(NSObject.FromObject("YOUR_PLACEMENT_ID"));
            

You can call the ShowInterstitial method like this:


Rm.ShowInterstitial(currentActivity, REVMOB_PLACEMENT_ID, showInterstitialAdListener);
            

Revmob.ShowInterstitial(NSObject.FromObject("YOUR_PLACEMENT_ID")); 
           
ant_smasher_fullscreen

Revmob's test Fullscreen ad.

3 Banner

Banner ads have a standard size of 320x50 for phones and 728x90 for tablets.

Pre-Loading the Ad:

For more control of your app, you can pre-load the banner, and then display it at any particular time you wish to do so

The banner will be displayed at the bottom, with the screen width.

You can call the CacheBanner method like this:


Rm.CacheBanner(REVMOB_PLACEMENT_ID, cacheBannerAdListener);
            

You can call the GetBanner method like this:


rmBannerView = (RMBannerView)Rm.GetBanner(currentActivity, REVMOB_PLACEMENT_ID, showBannerAdListener);
if (rmBannerView != null)
{
  ViewGroup view = FindViewById<ViewGroup>(Resource.Id.banner);
  view.RemoveAllViews();
  view.AddView(rmBannerView);
}
            

You can call the CacheBanner method like this:


Revmob.CacheBanner(NSObject.FromObject(REVMOB_PLACEMENT_ID));
            

You can call the GetBanner method like this:


RMBannerView rmBannerView = (RMBannerView) Revmob.GetBanner(NSObject.FromObject(REVMOB_PLACEMENT_ID));
if (rmBannerView != null)
{
  rmBannerView.Frame = new CGRect(0, 110, 300, 100);
  this.View.AddSubview(rmBannerView);
}
            
ant_smasher_banner

100-million-downloads Ant Smasher's home menu banner.

1 Native Ads

Native Ads can be used in two ways, Standard and Custom.

Native Standard

RMNativeViewStandard ads are Android Views can be used similarly to banners but the creatives are based on the advertised apps. The size of this adUnit is more flexible and it's image ratio is not fixed as in banners. You can choose between a few models in our website when creating placementIds according to your needs

When caching RMNativeViewStandard, you must provide the intended size of the ad, in DIP:


Rm.CacheNativeStandard(NSObject.FromObject(REVMOB_PLACEMENT_ID), width, height);

Revmob.CacheNativeStandard(NSObject.FromObject(REVMOB_PLACEMENT_ID), width, height);
  • If you support Small ad
    Small template size can use widths between 280 and 1200 dp
    Small template size can use height between 80 and 612 dp
  • If you support Large ad
    Large template size can use widths between 280 and 1200 dp
    Large template size can use height between 250 and 1200 dp

And to get a RMNativeViewStandard, just call:


RMNativeViewStandard rmNativeViewStandard = (RMNativeViewStandard)Rm.GetNativeStandard(this, NSObject.FromObject(REVMOB_PLACEMENT_ID));

RMNativeAdView rmNativeAdView =  (RMNativeAdView) Revmob.GetNativeStandard(NSObject.FromObject("REVMOB_PLACEMENT_ID"));

Then just add it to you current view:


view.AddSubview(rmNativeAdView);
        

view.AddView(rmNativeViewStandard);
        

In your Activity's layout, add a container for your Native Ad.




            

Native Custom

RMNativeAdObject ads are objects that hold a few properties that can be used to customize your own ad This type of ad is usually used in ListView or RecyclerView within app's native content

You can cache RMNativeAdObject by just calling:


Rm.CacheNativeCustom(REVMOB_NATIVE_ID);
        

Revmob.CacheNativeCustom(NSObject.FromObject(REVMOB_PLACEMENT_ID));
        

And to get a RMNativeAdObject, just call:


rmNativeObject = (RMNativeAdObject)Rm.GetNativeCustom(currentActivity, REVMOB_NATIVE_ID, showNativeCustomAdListener);    
    

rmNativeAdObject = (RMNativeAdObject)Revmob.GetNativeCustom(NSObject.FromObject(REVMOB_NATIVE_ID));
        

You can customize your ad with the following properties of the RMNativeAdObject:


nativeObject.Title          //App's title 
nativeObject.Description     //App's description 
nativeObject.IconImageUrl    //Url to the app's icon image 
nativeObject.MainImageUrl    //Url a creative of the app 
nativeObject.Market          //Store where the app is available 
nativeObject.Price           //App's price 
nativeObject.CallToAction    //Action to be completed (e.g. purchase, install) 
nativeObject.RatingStars    //App's rating in the store 
nativeObject.RatingUsers     //App's number of ratings 
            

rmNativeAdObject.Title          //App's title 
rmNativeAdObject.Description     //App's description 
rmNativeAdObject.IconImageUrl    //Url to the app's icon image 
rmNativeAdObject.MainImageUrl    //Url a creative of the app 
rmNativeAdObject.Market          //Store where the app is available 
rmNativeAdObject.Price           //App's price 
rmNativeAdObject.CallToAction    //Action to be completed (e.g. purchase, install) 
rmNativeAdObject.RatingStars    //App's rating in the store 
rmNativeAdObject.RatingUsers     //App's number of ratings 
            

To use the RMNativeAdObject, you must report the impressions and click events whenever you show the ad and whenever the ad is clicked, redirecting the user to the store. To do so, just call the following methods in your RMNativeAdObject instance:


nativeObject.ReportImpression(context); //To report impressions 
nativeObject.ReportClick(activity);     //To report clicks and to take the user to the store   
 

rmNativeAdObject.SendImpressionEvent(); //To report impressions 
rmNativeAdObject.SendClickEvent();     //To report clicks and to take the user to the store  
         


            

See our listeners section on how to implement our event handlers and have more control over what happens with the native ads.

ant_smasher_native

100-million-downloads Ant Smasher's success case.

5 Rewarded Video

Rewarded Video ads are offered as an option to earn digital currency in your app. You must tell the user it's an advertising video before showing the ad and giving the reward.
You can either prompt the user with a pre-roll box for him to accept or customize a button that he spontaneously will click, being aware that he's going to watch an advertising video.
Rewarded video ads are not skippable after the user has accepted to watch them.

You can call the CacheRewardedVideo method like this:


Rm.CacheRewardedVideo(REVMOB_PLACEMENT_ID, loadRewardedVideoAdListener);
            

You can call the CacheRewardedVideo method like this:


Revmob.CacheRewardedVideo(NSObject.FromObject(REVMOB_PLACEMENT_ID));
            

You can call the ShowRewardedVideo method like this:


Rm.ShowRewardedVideo(currentActivity, REVMOB_PLACEMENT_ID, showRewardedVideoAdListener);
           

You can call the ShowRewardedVideo method like this:


Revmob.ShowRewardedVideo(NSObject.FromObject(REVMOB_PLACEMENT_ID));
            
ant_smasher_video

Revmob's Video test ad

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


        class CallbackShowInterstitial : Java.Lang.Object, IRmListenerShow
        {
            Activity currentActivity;

            public CallbackShowInterstitial(Activity currentActivity)
            {
                this.currentActivity = currentActivity;
            }
            public void OnRmAdFailed(String error)
            {
                Console.WriteLine("Interstitial failed!");
            }

            public void OnRmAdDismissed()
            {
                Console.WriteLine("Interstitial dismissed!");
            }

            public void OnRmAdClicked()
            {
                Console.WriteLine("Interstitial clicked!");
            }

            public void OnRmAdDisplayed()
            {
                Console.WriteLine("Interstitial displayed!");
            }

        }

        class CallbackCacheInterstitial :  Java.Lang.Object, IRmListenerCache
        {
            Activity currentActivity;

            public CallbackCacheInterstitial(Activity currentActivity)
            {
                this.currentActivity = currentActivity;
            }

            public void OnRmAdNotReceived(String error)
            {
                Console.WriteLine("Interstitial not received!");
            }

            public void OnRmAdReceived()
            {
                Console.WriteLine("Interstitial ad received and ready to be displayed.");
            }

        }

        class CallbackCacheRewardedVideo : Java.Lang.Object, IRmListenerCache
        {
            Activity currentActivity;

            public CallbackCacheRewardedVideo(Activity currentActivity)
            {
                this.currentActivity = currentActivity;
            }

            public void OnRmAdReceived()
            {
                Console.WriteLine("Rewarded Video loaded.");
            }

            public void OnRmAdNotReceived(String error)
            {
                Console.WriteLine("Rewarded Video failed to load.");
            }

        }

        class CallbackShowRewardedVideo : Java.Lang.Object, IRmListenerShowRewardedVideo
        {
            Activity currentActivity;

            public CallbackShowRewardedVideo(Activity currentActivity)
            {
                this.currentActivity = currentActivity;
            }

            public void OnRmRewardedVideoCompleted()
            {
                Console.WriteLine("Rewarded Video completed.");
            }

            public void OnRmAdDisplayed()
            {
                Console.WriteLine("Rewarded Video displayed.");
            }
            public void OnRmAdFailed(String error)
            {
                Console.WriteLine("Rewarded Video failed to load.");

            }
            public void OnRmAdDismissed()
            {
                Console.WriteLine("Rewarded Video not completely loaded.");
            }
            public void OnRmAdClicked()
            {
                Console.WriteLine("Rewarded Video clicked");
            }
        }
        class CallbackCacheBanner : Java.Lang.Object, IRmListenerCache
        {
            Activity currentActivity;

            public CallbackCacheBanner(Activity currentActivity)
            {
                this.currentActivity = currentActivity;
            }

            public void OnRmAdNotReceived(String error)
            {
                Console.WriteLine("Banner not received!");
            }

            public void OnRmAdReceived()
            {
                Console.WriteLine("Banner ad received and ready to be displayed.");

            }
        }
        class CallbackShowBanner : Java.Lang.Object, IRmListenerGet
        {
            Activity currentActivity;

            public CallbackShowBanner(Activity currentActivity)
            {
                this.currentActivity = currentActivity;
            }

            public void OnRmAdFailed(String error)
            {
                Console.WriteLine("Banner not received!");
            }

            public void OnRmAdDisplayed()
            {
                Console.WriteLine("Banner displayed");
            }

            public void OnRmAdDismissed()
            {
                Console.WriteLine("Banner dismissed!");
            }

            public void OnRmAdClicked()
            {
                Console.WriteLine("Banner clicked!");
            }
        }

        class CallbackOpenLink : Java.Lang.Object, IRmListenerOpen
        {
            Activity currentActivity;

            public CallbackOpenLink(Activity currentActivity)
            {
                this.currentActivity = currentActivity;
            }
            public void OnRmAdFailed(String error)
            {
                Console.WriteLine("Link not received!");
            }
            public void OnRmAdClicked()
            {
                Console.WriteLine("Link clicked!");
            }
        }
        class CallbackCacheLink : Java.Lang.Object, IRmListenerCache
        {
            Activity currentActivity;

            public CallbackCacheLink(Activity currentActivity)
            {
                this.currentActivity = currentActivity;
            }

            public void OnRmAdNotReceived(String error)
            {
                Console.WriteLine("Link not received!");
            }

            public void OnRmAdReceived()
            {
                Console.WriteLine("Link ad received and ready to be displayed.");       
            }
        }

        class CallbackCacheNative : Java.Lang.Object, IRmListenerCache
        {
            Activity currentActivity;

            public CallbackCacheNative(Activity currentActivity)
            {
                this.currentActivity = currentActivity;
            }

            public void OnRmAdNotReceived(String error)
            {
                Console.WriteLine("Native not received!");
            }

            public void OnRmAdReceived()
            {
                Console.WriteLine("Native ad received and ready to be displayed.");
            }
        }
        class CallbackShowNative : Java.Lang.Object, IRmListenerGet
        {
            Activity currentActivity;

            public CallbackShowNative(Activity currentActivity)
            {
                this.currentActivity = currentActivity;
            }

            public void OnRmAdFailed(String error)
            {
                Console.WriteLine("Native not received!");
            }

            public void OnRmAdDisplayed()
            {
                Console.WriteLine("Native ad received and ready to be displayed.");
            }

            public void OnRmAdDismissed()
            {
                Console.WriteLine("Native dismissed!");
            }

            public void OnRmAdClicked()
            {
                Console.WriteLine("Native clicked!");
            }
        }

        class CallbackCacheNativeCustom : Java.Lang.Object, IRmListenerCache
        {
            Activity currentActivity;

        public CallbackCacheNativeCustom(Activity currentActivity)
            {
                this.currentActivity = currentActivity;
            }

            public void OnRmAdNotReceived(String error)
            {
                Console.WriteLine("Native Custom not received!");
            }

            public void OnRmAdReceived()
            {
                Console.WriteLine("Native Custom ad received and ready to be displayed.");
            }
        }
        class CallbackShowNativeCustom : Java.Lang.Object, IRmListenerGet
        {
            Activity currentActivity;

            public CallbackShowNativeCustom(Activity currentActivity)
            {
                this.currentActivity = currentActivity;
            }

            public void OnRmAdFailed(String error)
            {
                Console.WriteLine("Native Custom not received!");
            }

            public void OnRmAdDisplayed()
            {
                Console.WriteLine("Native Custom displayed.");
            }

            public void OnRmAdDismissed()
            {
                Console.WriteLine("Native Custom dismissed!");
            }

            public void OnRmAdClicked()
            {
                Console.WriteLine("Native Custom clicked!");
            }
        }
            

        class SampleRevmobDelegate : RevmobDelegate {

            public override void RevmobDidCacheAd(RMAdUnits adUnit, NSObject placement) {
                Console.WriteLine("RevmobDidCacheAd");

                switch (adUnit) { 
                    case RMAdUnits.Banner:
                        Console.WriteLine("Banner");
                        break;
                    case RMAdUnits.Interstitial:
                        Console.WriteLine("Interstitial");
                        break;                  
                    case RMAdUnits.Link:
                        Console.WriteLine("Link");
                        break;                  
                    case RMAdUnits.NativeAd:
                        Console.WriteLine("NativeAd");
                        break;                  
                    case RMAdUnits.RewardedVideo:
                        Console.WriteLine("RewardedVideo");
                        break;

                }
            }

            public override void RevmobAdClicked(RMAdUnits adUnit, NSObject placement) {        
                switch (adUnit) { 
                    case RMAdUnits.Banner:
                        Console.WriteLine("Banner");
                        break;
                    case RMAdUnits.Interstitial:
                        Console.WriteLine("Interstitial");
                        break;                  
                    case RMAdUnits.Link:
                        Console.WriteLine("Link");
                        break;                  
                    case RMAdUnits.NativeAd:
                        Console.WriteLine("NativeAd");
                        break;                  
                    case RMAdUnits.RewardedVideo:
                        Console.WriteLine("RewardedVideo");
                        break;

                }   
                Console.WriteLine("RevmobAdClicked");
            }

            public override void RevmobAdDisplayed(RMAdUnits adUnit, NSObject placement) {          
                Console.WriteLine("RevmobAdDisplayed");
            }

            public override void RevmobAdDismissed(RMAdUnits adUnit, NSObject placement) {          
                Console.WriteLine("RevmobAdDismissed");
            }

            public override void RevmobAdFailedToRender(RMAdUnits adUnit, NSObject placement) {             
                Console.WriteLine("RevmobAdFailedToRender");
            }

            public override void RevmobUserWillLeaveAplication(RMAdUnits adUnit, NSObject placement) {          
                Console.WriteLine("RevmobUserWillLeaveAplication");
            }

            public override void RevmobAdUnitFailedToCache(RMAdUnits adUnit, NSObject error, NSObject placement) {          
                Console.WriteLine("RevmobAdUnitFailedToCache");
            }

            public override void RevmobRewardedVideoActionDidCompleteOnPlacement(NSObject placement) {          
                Console.WriteLine("RevmobRewardedVideoActionDidCompleteOnPlacement");
            }
        }
            

Change Log (yyyy/mm/dd)

10.0.0 (2017/07/07)

  • New Added support for custom native ad formats.
  • New Added new APIs to implement Revmob SDK. MRAID v2 compliant
  • Bugfix Bug fixes and general improvements.

9.2.2 (2016/08/21)

  • ImportantUpdate Improved Android banner pre caching

9.2.0 (2016/08/11)

  • ImportantBugfix Improved memory performance.
  • New Added Load and Release Banner.
  • Update Improved Video Ad UX.
  • Bugfix Fixed minor bugs.

9.1.0 - 2016/06/15

  • NewImportant Xamarin component created, up to date with Android and iOS native SDKs.
  • Newnew First version.