Follow

Unity Plugin Integration

Table of Contents

 

 

1. Unity Integration


 

 

1.1 - Download Unity Plugin

 

Download Unity Plugin

Download InMobi iOS Mediation SDK

Download InMobi Android Mediation SDK

 

1.2 - Import the Unity Platform Plugin
  1. Open your project in the Unity editor.
  2. Select Assets > Import Package > Custom Package, and then find the aerserv-unity-plugin.unitypackage file you downloaded. Image_1.png

  3. Make sure all the files are selected, and then click Import. Image_2.png

 

1.3 - Building the AerServ Sample App (Optional)

 

  1. Create a new Unity project.
  2. Import the AerServ Unity platform plugin.
  3. Open File > Build Settings and add DemoAppStart, ASIntegration and InmobiIntegration scenes in Scenes In Build section. Image_3.png

  4. Continue to Step 2: Building the Project for iOS to build the Sample App for iOS.
  5. Continue to Step 3: Building the Project for Android to build the Sample App for Android.

 

1.4 - Initialize AerServ

 

You must initialize our SDK.  We recommend that you invoke this initialization routine at least 10 seconds before you intend to show your first ad.

To initialize the SDK, invoke the following: 


    private void SDKInit()
    {
        // Initialize the SDK with siteID and gdpr Consent
        ASSdk.InitSDK(SITE_ID, true);
        // Set the log level to see logs
        ASSdk.EnableDebugLogs(true);

        MonoBehaviour.print("SDK Initialised. The version of the SDK is " + ASSdk.GetSdkVersion());
    }

 

The second parameter is a GDPR consent, please check Setting GDPR Information section for more information.

How to obtain the app ID:

  1. Log on to the AerServ platform.
  2. Go to the 'Inventory' tab in the top navigation bar.
  3. Click the 'Edit' icon next to the app whose ID you wish to obtain.
  4. You will find the app ID at the very top of the page.
1.5 - Display Banner Ads

 

Create Banner

The first step toward displaying a banner is to create a ASBannerAd object in a C# script attached to a GameObject.

.....
using InMobiAds.Api;
...
public class AerServDemoIntegrationScript : MonoBehaviour
{
    private ASBannerAd aSBannerAd;

    private void RequestBanner()
    {
        String plId;

        #if UNITY_ANDROID
            plId = <ANDROID_PLC_ID>;
        #elif UNITY_IPHONE
            plId = <IOS_PLC_ID>;
        #endif

        // Create a 320x50 banner at the top of the screen.
        int width = 320;
        int height = 50;

        this.aSBannerAd = new ASBannerAd(plId, new AdSize(width, height), AdPosition.BottomCenter);

        // Turn on the banner refresh
        this.aSBannerAd.SetRefreshEnabled(true);

        // Set the refresh time interval
        this.aSBannerAd.SetRefreshInterval(20);

        // Load the banner ad
        this.aSBannerAd.Load();

        // Show the banner ad
        this.aSBannerAd.Show();
    }
}

 

Where adPosition is a predefined set of banner ad positions on the screen. You can only pass values available under AdPosition enum. Currently, we support:

  • AdPosition.TopCenter
  • AdPosition.BottomCenter
  • AdPosition.TopLeft
  • AdPosition.TopRight
  • AdPosition.BottomLeft
  • AdPosition.BottomRight
  • AdPosition.Center

If you need to position banner ad at custom coordinates then you can use the below API to create a banner ad object.

this.aSBannerAd = new ASBannerAd(plId, new AdSize(width, height), positionX, positionY);

You can also set other properties like pubKeywords and debug like these:


this.aSBannerAd.SetDebug(true);
Dictionary<string, string> keywordsDictionary = new Dictionary<string, string>();
keywordsDictionary.Add("KEY",”VALUE”);
this.aSBannerAd.SetPubKeywords(keywordsDictionary);

Ad Events

To further customize the behavior of your ad, you can hook into a number of events in the ad's lifecycle: loading, opening, closing, and so on. Listen for these events by registering a delegate for the appropriate EventHandler, as shown below.



.....
using InMobiAds.Api;
...
public class AerServDemoIntegrationScript : MonoBehaviour
{
    private ASBannerAd aSBannerAd;

    private void RequestBanner()
    {
        String plId;

        #if UNITY_ANDROID
            plId = <ANDROID_PLC_ID>;
        #elif UNITY_IPHONE
            plId = <IOS_PLC_ID>;
        #endif

        // Create a 320x50 banner at the top of the screen.
        int width = 320;
        int height = 50;

        this.aSBannerAd = new ASBannerAd(plId, new AdSize(width, height), AdPosition.BottomCenter);

         // Set ad event listeners
         // Called when an ad successfully loaded
        aSBannerAd.OnAdLoadSucceeded += this.HandleOnAdLoadSucceeded; 
         // Called when an ad failed to load
        aSBannerAd.OnAdLoadFailed += this.HandleAdLoadFailed;
         // Called when the ad sends an ad impression
        aSBannerAd.OnAdImpression += this.HandleAdImpression;
         // Called when an ad is first fetched with the transaction information (buyer price, buyer name etc.). 
        aSBannerAd.OnAdLoadWithTransaction += this.HandleAdLoadWithTransaction;
        // Called when an ad is successfully shown, this method provides the transaction information (buyer price, buyer name etc.) of the Ad being shown.
        aSBannerAd.OnAdShowWithTransaction += this.HandleAdShowWithTransaction;
        // Called when an ad expanded to fullScreen.
        aSBannerAd.OnAdExpanded += this.HandleAdExpanded;
        // Called when an ad collapsed from fullScreen.
        aSBannerAd.OnAdCollapsed += this.HandleAdCollapsed;
        // Called when an ad is clicked.
        aSBannerAd.OnAdClicked += this.HandleAdClicked;
        // Called when the ad click caused the user to leave the application.
        aSBannerAd.OnUserLeftApplication += this.HandleUserLeftApplication;


        // Set the refresh time interval 
        this.aSBannerAd.SetRefreshInterval(20);

        // Load the banner ad
        this.aSBannerAd.Load();

        // Show the banner ad
        this.aSBannerAd.Show();

    }

    public void HandleOnAdLoadSucceeded(object sender, EventArgs args)
    {
        MonoBehaviour.print("AdLoadSucceeded");
    }

    public void HandleAdLoadFailed(object sender, AdLoadFailedEventArgs args)
    {
        MonoBehaviour.print("AdLoadFailed " + args.Error);
    }

    public void HandleAdImpression(object sender, EventArgs args)
    {
        MonoBehaviour.print("AdImpression");
    }

    public void HandleAdLoadWithTransaction(object sender, AdTransactionArgs args)
    {
        foreach (KeyValuePair<string, string> transactionDictionary in args.Transaction)
        {
            MonoBehaviour.print("transactionDictionary = " + transactionDictionary.Key + " and " + transactionDictionary.Value);
        }
    }

    public void HandleAdShowWithTransaction(object sender, AdTransactionArgs args)
    {
        foreach (KeyValuePair<string, string> transactionDictionary in args.Transaction)
        {
            MonoBehaviour.print("transactionDictionary = " + transactionDictionary.Key + " and " + transactionDictionary.Value);
        }
    }

    public void HandleAdExpanded(object sender, EventArgs args)
    {
        MonoBehaviour.print("AdExpanded");
    }

    public void HandleAdCollapsed(object sender, EventArgs args)
    {
        MonoBehaviour.print("AdCollapsed");
    }

    public void HandleAdClicked(object sender, EventArgs args)
    {
        MonoBehaviour.print("AdClicked");
    }

    public void HandleUserLeftApplication(object sender, EventArgs args)
    {
        MonoBehaviour.print("UserLeftApplication");
    }
}

Clean up banner ads

When you create the ASBannerAd object the banner is added into the view hierarchy, so when the object is not required anymore and you want to remove from view hierarchy then you need to call kill() on the banner object as follow.


 private void KillBanner()
 {
        this.aSBannerAd.Kill();
 }

 

1.6 - Display Interstitial Ads

Interstitial ads are full page ads placed at natural break points in the app flow. With 10 times the real estate as compared to banner ads, Interstitials are guaranteed to catch your user's’ eye and drive higher revenue for your mobile business.

Create an interstitial ad

ASInterstitialAd class allows you to create and display interstitial ads with the specified parameters. Please follow the below steps to integrate the Interstitial.


.....
using InMobiAds.Api;
...
public class AerServDemoIntegrationScript : MonoBehaviour
{
    private ASInterstitialAd aSInterstitialAd;

    private void RequestInterstitial()
    {
        String plId;

        #if UNITY_ANDROID
            plId = <ANDROID_PLC_ID>;
        #elif UNITY_IPHONE
            plId = <IOS_PLC_ID>;
        #endif

        //Create interstitial object
        this.aSInterstitialAd = new ASInterstitialAd(plId);

        // Load the interstitial ad.
        this.aSInterstitialAd.Load();
    }

}

 

You can set other properties like pubKeywords and debug as follows.


this.aSInterstitialAd.SetDebug(true);
Dictionary<string, string> keywordsDictionary = new Dictionary<string, string>();
keywordsDictionary.Add("KEY",”VALUE”);
this.aSInterstitialAd.SetPubKeywords(keywordsDictionary);

 

Ad events

To further customize the behavior of your ad, you can hook into a number of events in the ad's lifecycle: loading, opening, closing, and so on. Listen for these events by registering a delegate for the appropriate EventHandler, as shown below.


.....
using InMobiAds.Api;
...
public class AerServDemoIntegrationScript : MonoBehaviour
{
    private ASInterstitialAd aSInterstitialAd;

    private void RequestInterstitial()
    {
        String plId;

        #if UNITY_ANDROID
            plId = <ANDROID_PLC_ID>;
        #elif UNITY_IPHONE
            plId = <IOS_PLC_ID>;
        #endif
        
         //Create interstitial object
        this.aSInterstitialAd = new ASInterstitialAd(plId);

         
        // Called when an ad successfully loaded
        aSInterstitialAd.OnAdLoadSucceeded += this.HandleOnAdLoadSucceeded; 
        // Called when an ad failed to load
        aSInterstitialAd.OnAdLoadFailed += this.HandleAdLoadFailed;
        // Called when the ad sends an ad impression
        aSInterstitialAd.OnAdImpression += this.HandleAdImpression;
        // Called when an ad is first fetched with the transaction information (buyer price, buyer name etc.).
        aSInterstitialAd.OnAdLoadWithTransaction += this.HandleAdLoadWithTransaction;
        // Called when an ad is successfully shown, this method provides the transaction information (buyer price, buyer name etc.) of the Ad being shown.
        aSInterstitialAd.OnAdShowWithTransaction += this.HandleAdShowWithTransaction;
        // Called when an ad dismissed from fullScreen.
        this.aSInterstitialAd.OnAdDismissed += this.HandleAdDismissed;
        // Called when an ad is clicked.
        aSInterstitialAd.OnAdClicked += this.HandleAdClicked;
        // Called when the ad click caused the user to leave the application.
        aSInterstitialAd.OnUserLeftApplication += this.HandleUserLeftApplication;
        // Called when an ad with a virtual currency reward has loaded with reward information
        this.aSInterstitialAd.OnDidVirtualCurrencyLoad += this.HandleVirtualCurrencyLoaded;
        // Called when an ad with a virtual currency reward has been rewarded, it passes the reward information with the callback
        this.aSInterstitialAd.OnDidVirtualCurrencyReward += this.HandleVirtualCurrencyRewarded;

        // Load the interstitial ad.
        this.aSInterstitialAd.Load();

    }


    public void HandleOnAdLoadSucceeded(object sender, EventArgs args)
    {
        MonoBehaviour.print("AdLoadSucceeded");
    }

    public void HandleAdLoadFailed(object sender, AdLoadFailedEventArgs args)
    {
        MonoBehaviour.print("AdLoadFailed " + args.Error);
    }

    public void HandleAdImpression(object sender, EventArgs args)
    {
        MonoBehaviour.print("AdImpression");
    }

    public void HandleAdLoadWithTransaction(object sender, AdTransactionArgs args)
    {
        foreach (KeyValuePair<string, string> transactionDictionary in args.Transaction)
        {
            MonoBehaviour.print("transactionDictionary = " + transactionDictionary.Key + " and " + transactionDictionary.Value);
        }
    }

    public void HandleAdShowWithTransaction(object sender, AdTransactionArgs args)
    {
        foreach (KeyValuePair<string, string> transactionDictionary in args.Transaction)
        {
            MonoBehaviour.print("transactionDictionary = " + transactionDictionary.Key + " and " + transactionDictionary.Value);
        }
    }

    public void HandleAdExpanded(object sender, EventArgs args)
    {
        MonoBehaviour.print("AdExpanded");
    }

    public void HandleAdCollapsed(object sender, EventArgs args)
    {
        MonoBehaviour.print("AdCollapsed");
    }

    public void HandleAdClicked(object sender, EventArgs args)
    {
        MonoBehaviour.print("AdClicked");
    }

    public void HandleUserLeftApplication(object sender, EventArgs args)
    {
        MonoBehaviour.print("UserLeftApplication");
    }

    public void HandleAdDismissed(object sender, EventArgs args)
    {
        MonoBehaviour.print("AdDismissed");
    }

    public void HandleVirtualCurrencyLoaded(object sender, AdRewardsArgs args)
    {
        foreach (KeyValuePair<string, string> rewardDictionary in args.Reward)
        {
            MonoBehaviour.print("VirtualCurrencyLoaded RewardDictionary = " + rewardDictionary.Key + " and " + rewardDictionary.Value);
        }
    }

    public void HandleVirtualCurrencyRewarded(object sender, AdRewardsArgs args)
    {
        foreach (KeyValuePair<string, string> rewardDictionary in args.Reward)
        {
            MonoBehaviour.print("VirtualCurrencyRewarded RewardDictionary = " + rewardDictionary.Key + " and " + rewardDictionary.Value);
        }
    }
}

 

Show the Interstitial Ad

 

IOS

For good practice we recommended to show the interstitial ad after OnAdLoadSucceeded.


public void HandleOnAdLoadSucceeded(object sender, EventArgs args)
    {
        #if (UNITY_5 & UNITY_IOS) || UNITY_IPHONE
             this.aSInterstitialAd.Show();
        }
        #endif
        MonoBehaviour.print("AdLoadSucceeded");
    }

 

Android

For good practice we recommended to show the interstitial ad after AdLoadWithTransaction.


 public void HandleAdLoadWithTransaction(object sender, AdTransactionArgs args)
    {
        #if UNITY_ANDROID
             this.aSInterstitialAd.Show();
        }
        #endif

        
        foreach (KeyValuePair<string, string> transactionDictionary in args.Transaction)
        {
           MonoBehaviour.print("transactionDictionary = " + transactionDictionary.Key + " and " + transactionDictionary.Value);
        }

    }

 

1.7 - Setting GDPR Information

 

The plugin expects the publisher to collect user consent from the consent gathering mechanism of his own, and the plugin provides these APIs to pass on this information to the SDK.

For setting GDPR and updating GDPR on AerServ SDK you can one of the following methods:

 

  • At the time of initialization, you can set GDPR consent this way:

    
        ASSdk.InitSDK(siteId, true);
                      OR
        ASSdk.InitSDK(siteId, false);
        

    The second parameter of this method denotes the GDPR consent.

  • After initialization of the SDK, you can update the GDPR consent this way:

    
        ASSdk.UpdateGdpr(true);
                      OR
        ASSdk.UpdateGdpr(false);
        

Note: If the user consent is available, then the publisher has to call the API with either a true value, or a false value. This is applicable for both these methods.

 
Mediation Disclaimer: 

Please be advised that although we are GDPR compliant, we currently have no way to send GDPR compliance as well as user consent to our mediated SDK partners. Compliance responsibility and request handling will solely depend on the SDK mediated partner. Please contact your mediated partners to avoid any issues and/or complications.

 

2. Building the Project for iOS


 

2.1 - Build the project for iOS in Unity. 

 

This can be done by going to File > Build Settings and select iOS as the platform. Click build and this should start Xcode.

 

2.2 - Add the project.

 

In the project add InMobiSDK.framework with the following path  Frameworks/Plugins/iOS/Frameworks/InMobiSDK/InMobiSDK.framework.

From inside Xcode, add the [Project Path]/Plugins/iOS directory into Target > Build Setting > Framework Search Path.

 

2.3 - Add the following libraries and frameworks.

 

Add the following libraries and frameworks to Target > Build Phases > Link Binary With Libraries:

  • InMobiSDK.framework
  • libxml2.2.tbd
  • WebKit.framework

 

2.4 - Turn Bitcode off.

 

Turn bitcode off by going to Target > Build Settings > Bitcode Enabled and setting that to NO.

 

2.5 - Add linker flags.

 

Add the following linker flags to Target > Build Settings > Linking > Other Linker Flags:

  • -ObjC

 

2.6 - Add the entries.

 

Add the following entries to your Application’s info.plist: 

<key>NSLocationWhenInUseUsageDescription</key>
<string>Location is used to help target content to your general area</string>

<key>NSAppTransportSecurity</key>
<dict>
	<key>NSAllowsArbitraryLoads</key>
        <true/>
</dict>

 

 

3. Building the Project for Android


  

3.1 - Build the APK.

 

Build the apk by going to File > Build Settings, select Android and click build. 

Follow Multidex support if required. 

  

 

4. Third Party Mediation Support in Unity


 

Only complete the following step as needed for third-party SDK mediation.

 

 

4.1 - AdColony

 

  • iOS
  • Android
  1. Build the project for iOS in Unity. This can be done by going to File > Build Settings and select iOS as the platform. Click build and this should start Xcode.
  2. From inside Xcode, add the Frameworks/Plugins/iOS/Frameworks/InMobiSDK/network-support/AdColony directory into Target > Build Setting > Framework Search Path.
  3. Open Target > Build Settings > Under Architectures, confirm that your Xcode project uses Base SDK version 9.0 or greater and that it does not use the armv6 architecture.
  4. Add the following libraries and frameworks to Target > Build Phases > Link Binary With Libraries:
    • AdColony.framework
    • AdSupport.framework
    • AudioToolbox.framework
    • AVFoundation.framework
    • CoreTelephony.framework
    • EventKit.framework
    • Javascript.framework (Set to Optional)
    • libz.1.2.5.dylib
    • MessageUI.framework
    • Social.framework
    • StoreKit.framework
    • SystemConfiguration.framework
    • WatchConnectivity.framework (Set to Optional)
  5. Add the following linker flags to Target > Build Settings > Linking > Other Linker Flags:
    • -fobjc-arc (this allows AdColony to use ARC even if your project does not)
  6. Add the following entries into your Application’s info.plist:
    
    <key>NSCalendarsUsageDescription</key>
    <string>Some ad content may create a calendar event.</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>Some ad content may require access to the photo library.</string>
    <key>NSCameraUsageDescription</key>
    <string>Some ad content may access camera to take picture.</string>
    <key>NSMotionUsageDescription</key>
    <string>Some ad content may require access to accelerometer for interactive ad experience.</string>
    
    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>fb</string>
        <string>instagram</string>
        <string>tumblr</string>
        <string>twitter</string>
    </array>
  7. More info on how to set up the AdColony ad source in the AerServ mediation platform: here
  1. Copy the entire contents of [InMobiSDK download path]/dist/network-support/AdColony into [Project Path]/Assets/Plugins/Android/libs folder.
  2. Add the following to your AndroidManifest.xml:
    
    ...
    <!-- Required by AdColony -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE />
    
    <!-- Optional, but recommended by AdColony -->
    <uses-permission android:name="android.permission.VIBRATE" /> 
    
    <application>
    … 
      <activity 
        android:name="com.adcolony.sdk.AdColonyInterstitialActivity" 
        android:configChanges="keyboardHidden|orientation|screenSize" 
        android:hardwareAccelerated="true"/> 
    </application> 
  3. More info on how to set up the AdColony ad source in the AerServ mediation platform: here

 

 

 

 

 

 

 

 

 

 

 

 

 

 

4.2 - AdMob

 

  • iOS
  • Android
  1. Build the project for iOS in Unity. This can be done by going to File > Build Settings and select iOS as the platform. Click build and this should start Xcode.
  2. From inside Xcode, add the Frameworks/Plugins/iOS/Frameworks/InMobiSDK/network-support/AdMob directory into Target > Build Setting > Framework Search Path.
  3. Add the following libraries and frameworks to Target > Build Phases > Link Binary With Libraries:
    • AdSupport.framework (Set to Optional)
    • AudioToolbox.framework
    • AVFoundation.framework
    • CoreGraphics.framework
    • CoreMedia.framework
    • CoreMotion.framework
    • CoreTelephoney.framework
    • CoreVideo.framework
    • EventKit.framework
    • EventKitUI.framework
    • GLKit.framework
    • GoogleMobileAds.framework
    • JavascriptCore.framework (Set to Optional)
    • MessageUI.framework
    • MediatePlayer.framework
    • SafariServices.framework (Set to Optional)
    • MobileCoreServices.framework
    • StoreKit.framework
    • SystemConfiguration.framework
  4. More info on how to set up the Google AdMob ad source in the AerServ mediation platform: here
  1. The google-play-services.jar is already included in the unity package. If you want to change the version or use modularise dependencies then you can replace it just make sure to include play-services-ads dependency.
  2. Add the following to your AndroidManifest.xml
    <activity 
    android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
  3. More info on how to set up the AdMob ad source in the AerServ mediation platform: here

 

 

  

 

 

 

4.3 - AppLovin

 

  • iOS
  • Android
  1. Build the project for iOS in Unity. This can be done by going to File > Build Settings and select iOS as the platform. Click build and this should start Xcode.
  2. From inside Xcode, add the network-support/iOS/AppLovin directory into Target > Build Setting > Framework Search Path.
  3. Add the following libraries and frameworks to Target > Build Phases > Link Binary With Libraries:
    • AppLovinSDK.framework
    • AdSupport.framework
    • AVFoundation.framework
    • CoreGraphics.framework
    • CoreMedia.framework
    • CoreTelephony.framework
    • StoreKit.framework
    • SystemConfiguration.framework
    • UIKit.framework
    • WebKit.framework (Set to Optional)
  4. More info on how to set up the AppLovin ad source in the AerServ mediation platform: here
  1. Copy the entire contents of [InMobiSDK download path]/dist/network-support/Android/AppLovin into [Project Path]/Assets/Plugins/Android/libs folder.
  2. Add the following to your AndroidManifest.xml:
    
    …
      
    <application
    …  
      <activity
        android:name="com.applovin.adview.AppLovinInterstitialActivity" />   
      <activity
        android:name="com.applovin.adview.AppLovinConfirmationActivity" />
    </application>
    
  3. More info on how to set up the AppLovin ad source in the AerServ mediation platform: here

 

 

 

 

4.4 - Chartboost

 

  • iOS
  • Android
  1. Build the project for iOS in Unity. This can be done by going to File > Build Settings and select iOS as the platform. Click build and this should start Xcode.
  2. From inside Xcode, add the Frameworks/Plugins/iOS/Frameworks/InMobiSDK/network-support/Chartboost directory into Target > Build Setting > Framework Search Path.
  3. Add the following libraries and frameworks to Target > Build Phases > Link Binary With Libraries:
    • Chartboost.framework
    • CoreGraphics.framework
    • Foundation.framework
    • StoreKit.framework
    • UIKit.framework
    • WebKit.framework
  4. More info on how to set up the Chartboost ad source in the AerServ mediation platform: here

 

  1. Copy the entire contents of [InMobiSDK download path]/dist/network-support/Android/Chartboost into [Project Path]/Assets/Plugins/Android/libs folder.
  2. Add the following to your AndroidManifest.xml:
    
    …
    <!-- Optional, but recommended by Chartboost -->
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.READ.PHONE_STATE" />
    
    <application>
    …
      <activity
        android:name="com.chartboost.sdk.CBImpressionActivity"   
        android:excludeFromRecents="true"
        android:hardwareAccelerated="true" 
        android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"   
        android:configChanges="keyboardHidden|orientation|screenSize" />
    </application>
    
  3. More info on how to set up the Chartboost ad source in the AerServ mediation platform: here

 

 

4.5 - Facebook Audience Network

 

  • iOS
  • Android
  1. Build the project for iOS in Unity. This can be done by going to File > Build Settings and select iOS as the platform. Click build and this should start Xcode.
  2. From inside Xcode, add the Frameworks/Plugins/iOS/Frameworks/InMobiSDK/network-support/Facebook directory into Target > Build Setting > Framework Search Path.
  3. Add the following libraries and frameworks to Target > Build Phases > Link Binary With Libraries:
    • AudioToolbox.framework
    • AVFoundation.framework
    • CoreGraphics.framework
    • CoreImage.framework
    • CoreMedia.framework
    • CoreMotion.framework (Set to Optional)
    • FBAudienceNetwork.framework
    • Foundation.framework
    • libc++.tbd
    • libxml2.tbd
    • SafariServices.framework (Set to Optional)
    • Security.framework
    • StoreKit.framework
    • UIKit.framework
    • WebKit.framework (Set to Optional)
  4. More info on how to set up the Facebook Audience Network ad source in the AerServ mediation platform: here

 

  1. Copy the entire contents of [InMobiSDK download path]/dist/network-support/Android/Facebook into [Project Path]/Assets/Plugins/Android/libs folder.
  2. Add the following to your AndroidManifest.xml:


    <application>

    <activity
    android:name="com.facebook.ads.AudienceNetworkActivity"
    android:configChanges="keyboardHidden|orientation|screenSize" />
    </application>
  3. More info on how to set up the Facebook Audience Network ad source in the AerServ mediation platform: here

 

 

4.6 - Flurry (Yahoo)

 

  • iOS
  • Android
  1. Build the project for iOS in Unity. This can be done by going to File > Build Settings and select iOS as the platform. Click build and this should start Xcode.
  2. From inside Xcode, add the Frameworks/Plugins/iOS/Frameworks/InMobiSDK/network-support/Flurry directory into Target > Build Setting > Library Search Path. You’ll need to set the search path to be recursive.
  3. Add the Frameworks/Plugins/iOS/Frameworks/InMobiSDK/network-support/Flurry directory into Target > Build Setting > Header Search Path. You’ll need to set the search path to be recursive.
  4. Add the following libraries and frameworks to Target > Build Phases > Link Binary With Libraries:
    • libFlurryAds_x.x.x.a
    • libFlurry_x.x.x.a
  5. More info on how to set up the Flurry (Yahoo) ad source in the AerServ mediation platform: here
  1. Copy the entire contents of [InMobiSDK download path]/dist/network-support/Android/Flurry into [Project Path]/Assets/Plugins/Android/libs folder.
  2. Add the following to your AndroidManifest.xml:


    <application>

    <activity
    android:name="com.flurry.android.FlurryFullscreenTakeoverActivity"
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
    </application>
  3. More info on how to set up the Flurry (Yahoo) ad source in the AerServ mediation platform: here

 

 

4.7 - ONE By AOL (Millennial Media)

 

  • iOS
  • Android
  1. Build the project for iOS in Unity. This can be done by going to File > Build Settings and select iOS as the platform. Click build and this should start Xcode.
  2. From inside Xcode, add the Frameworks/Plugins/iOS/Frameworks/InMobiSDK/network-support/MillennialMedia directory into Target > Build Setting > Framework Search Path.
  3. Add the following libraries and frameworks to Target > Build Phases > Link Binary With Libraries:
    • AdSupport.framework
    • AudioToolbox.framework
    • AVFoundation.framework
    • CoreGraphics.framework
    • CoreLocation.framework
    • CoreTelephony.framework
    • CoreMedia.framework
    • EventKit.framework
    • EventKitUI.framework
    • Foundation.framework
    • libxml2.tbd
    • MediaPlayer.framework
    • MessageUI.framework
    • MMAdSDK.framework
    • SystemConfiguration.framework
    • UIKit.framework
  4. Add the following entries to your application's info.plist:
    <key>NSCalendarsUsageDescription</key>
    <string>Some ad content may create a calendar event.</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>Some ad content may require access to the photo library.</string>
    <key>NSCameraUsageDescription</key>
    <string>Some ad content may access camera to take picture.</string>
    <key>NSMotionUsageDescription</key>
    <string>Some ad content may require access to accelerometer for interactive ad experience.</string>
  5. More info on how to set up the ONE By AOL (Millennial Media) ad source in the AerServ mediation platform: here
  1. Copy the entire contents of [InMobiSDK download path]/dist/network-support/Android/MillennialMedia into [Project Path]/Assets/Plugins/Android/libs folder.
  2. Add the following to your AndroidManifest.xml:
    
    ...
    <!-- Required by ONE by AOL (Millennial Media) -->
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission-sdk-23 android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_CALENDAR" />
    <uses-permission android:name="android.permission.NFC" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    
    <application>
    …
    </application>
    
  3. More info on how to set up the ONE By AOL (Millennial Media) ad source in the AerServ mediation platform: here

 

 

 

 

 

 

 

 

 

 

 

4.8 - MoPub

 

  • iOS
  • Android
  1. Build the project for iOS in Unity. This can be done by going to File > Build Settings and select iOS as the platform. Click build and this should start Xcode.
  2. From inside Xcode, add the Mopub source file into your project. You can drag and drop the files into your project.
  3. Add the following libraries and frameworks to Target > Build Phases > Link Binary With Libraries:
    • AdSupport.framework
    • CoreGraphics.framework
    • CoreLocation.framework
    • CoreMedia.framework
    • CoreTelephony.framework
    • Foundation.framework
    • MediaPlayer.framework
    • QuartzCore.framework
    • StoreKit.framework
    • SystemConfiguration.framework
    • UIKit.framework
  4. More info on how to set up the Mopub ad source in the AerServ mediation platform: here
  1. Copy the entire contents of [InMobiSDK download path]/dist/network-support/Android/Mopub into [Project Path]/Assets/Plugins/Android/libs folder.
  2. Add the following to your AndroidManifest.xml:
    
    ...
    <!-- Required by MoPub -->
    <uses-permission android:name="android.permission.ACCESS.NETWORK.STATE />
    
    <application>
    ...
      <activity 
        android:name="com.mopub.mobileads.MoPubActivity"   
        android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize" />
      <activity
        android:name="com.mopub.mobileads.MraidActivity"
        android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize" />
      <activity
        android:name="com.mopub.common.MoPubBrowser"
        android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize" />
      <activity
        android:name="com.mopub.mobileads.MraidVideoPlayerActivity"
        android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize" />
    </application>
  3. More info on how to set up the MoPub ad source in the AerServ mediation platform: here

 

 

4.9 - RhythmOne

 

  • iOS
  • Android
  1. Build the project for iOS in Unity. This can be done by going to File > Build Settings and select iOS as the platform. Click build and this should start Xcode.
  2. From inside Xcode, add Frameworks/Plugins/iOS/Frameworks/InMobiSDK/network-support/RhythmOne directory into Target > Build Setting > Framework Search Path.
  3. Add the following libraries and frameworks to Target > Build Phases > Link Binary With Libraries:
    • AdSupport.framework
    • AudioToolbox.framework (Set to Optional)
    • AVFoundation.framework (Set to Optional)
    • AVKit.framework (Set to Optional)
    • CoreLocation.framework
    • CoreTelephony.framework (Set to Optional)
    • RhythmOneAds.framework
    • RYMMoatMobileAppKit.framework
    • MessageUI.framework
    • SystemConfiguration.framework
  4. Add the following entries to your application's info.plist:
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>Some ad content may create a location.</string>
  5. More info on how to set up the RhythmOne ad source in the AerServ mediation platform: here
  1. Copy the entire contents of [InMobiSDK download path]/dist/network-support/Android/RhythmOne into [Project Path]/Assets/Plugins/Android/libs folder.
  2. Add the following to your AndroidManifest.xml:
    
    ...
    <!-- Required by RhythmOne -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    
    <!-- Optional, but recommended by RhythmOne -->
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.VIBRATE" />
    
    <application>
    ...
      <activity
        android:name="com.rhythmone.ad.sdk.RhythmOneAdActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:label="RhythmOneAdActivity" 
        android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    </application>
    
  3. More info on how to set up the RhythmOne ad source in the AerServ mediation platform: here

 

 

 

 

4.10 - Telaria (Tremor)

 

  • iOS
  • Android
  1. Build the project for iOS in Unity. This can be done by going to File > Build Settings and select iOS as the platform. Click build and this should start Xcode.
  2. From inside Xcode, add Frameworks/Plugins/iOS/Frameworks/InMobiSDK/network-support/Tremor directory into Target > Build Setting > Framework Search Path.
  3. Add the following libraries and frameworks to Target > Build Phases > Link Binary With Libraries:
    • TremorVideoAd.framework
  4. More info on how to set up the Tremor ad source in the AerServ mediation platform: here

 

 

 

 

 

  1. Copy the entire contents of [InMobiSDK download path]/dist/network-support/Android/Tremor into [Project Path]/Assets/Plugins/Android/libs folder.
  2. Add the following to your AndroidManifest.xml:
    
    ...
    <!-- Required by Telaria -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    
    <application>
    ...
      <activity
        android:name="com.tremorvideo.sdk.android.videoad.Playvideo"
        android:configChanges="keyboardHidden|orientation|screenSize"   
        android:hardwareAccelerated="false"
        android:exported="false">      
        <intent-filter>
          <action
            android:name="com.tremorvideo.sdk.android.videoad.Playvideo" />        
            <category
              android:name="android.intent.category.EMBED" />      
          </intent-filter>
      </activity>
    </application>
    
  3. More info on how to set up the Tremor ad source in the AerServ mediation platform: here

 

 

4.11 - Unity Ads

 

  • iOS
  • Android
  1. Build the project for iOS in Unity. This can be done by going to File > Build Settings and select iOS as the platform. Click build and this should start Xcode.
  2. From inside Xcode, add Frameworks/Plugins/iOS/Frameworks/InMobiSDK/network-support/Unity directory into Target > Build Setting > Framework Search Path.
  3. Add the following libraries and frameworks to Target > Build Phases > Link Binary With Libraries:
    • UnityAds.framework
  4. More info on how to set up the Unity Ads ad source in the AerServ mediation platform: here
  1. Copy the entire contents of [InMobiSDK download path]/dist/network-support/Android/Unity into [Project Path]/Assets/Plugins/Android/libs folder.
  2. More info on how to set up the Unity Ads ad source in the AerServ mediation platform: here

 

 

 

 

4.12 - Vungle

 

  • iOS
  • Android
  1. Build the project for iOS in Unity. This can be done by going to File > Build Settings and select iOS as the platform. Click build and this should start Xcode.
  2. From inside Xcode, add Frameworks/Plugins/iOS/Frameworks/InMobiSDK/network-support/Vungle/VungleSDK.embeddedframework directory into Target > Build Setting > Framework Search Path.
  3. Add the Vungle resources files from Frameworks/Plugins/iOS/Frameworks/InMobiSDK/network-support/Vungle/VungleSDK.embeddedframework/Resources to Target > Build Phase > Copy Bundle Resources.
  4. Add the following libraries and frameworks to Target > Build Phases > Link Binary With Libraries:
    • AdSupport.framework
    • AudioToolbox.framework
    • AVFoundation.framework
    • CFNetwork.framework
    • CoreGraphics.framework
    • CoreMedia.framework
    • Foundation.framework
    • libz.tbd
    • libsqlite3.tbd
    • MediaPlayer.framework
    • QuartzCore.framework
    • StoreKit.framework
    • SystemConfiguration.framework
    • UIKit.framework
    • VungleSDK.framework
  5. More info on how to set up the Vungle ad source in the AerServ mediation platform: here
  1. Copy the entire contents of [InMobiSDK download path]/dist/network-support/Android/Vungle into [Project Path]/Assets/Plugins/Android/libs folder.
  2. Add the following to your AndroidManifest.xml:
    
            ...
    <application>
    ...
    <activity
    android:name="com.vungle.warren.ui.VungleActivity"
    android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
    android:launchMode="singleTop"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
    <activity
    android:name="com.vungle.warren.ui.VungleFlexViewActivity"
    android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
    android:launchMode="singleTop"
    android:hardwareAccelerated="true"
    android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    <activity
    android:name="com.vungle.warren.ui.VungleWebViewActivity"
    android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
    android:launchMode="singleTop" /> </application>
  3. More info on how to set up the Vungle ad source in the AerServ mediation platform: here

 

 

 

 

 

 

 

  

 

5. Multidex support in Unity (Only for Android)


 

If you are getting this error (com.android.builder.dexing.DexArchiveMergerException) while building the Unity app, then please follow this section to enable multidex in your app.

This happens when dex archives are merged, as the number of method references in a dex file cannot exceed 64K.

    1. Go to player Settings > Publishing Settings and check the custom gradle template checkbox. This will generate a custom gradle file and the path will be shown below the checkbox

Multidex_for_Unity_Plugin.png

    1. Open the custom gradle file and add following line:
      
              dependencies {
                  ...
                  implementation ‘com.android.support:multidex:1.0.3’
                  ...
                  **DEPS**
              }
              android {
                  defaultConfig {
                      ...
                      multiDexEnabled true
                  }
                  ...
              }
              
    2. Open your AndroidManifest.xml and add the following line:
      <?xml version=“1.0” encoding=“utf-8"?>
      <manifest xmlns:android=“http://schemas.android.com/apk/res/android
         package=“com.example.myapp”>
         <application android:name=“android.support.multidex.MultiDexApplication” >
             ...
         </application>
      </manifest>

 

 

 

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments