Table of Contents
2. Building the Project for iOS
3. Building the Project for Android
4. Adding Third-Party Mediation Support
4.1 AdColony
4.2 AdMob
4.3 AppLovin
4.4 Chartboost
4.6 Flurry (Yahoo)
4.7 ONE By AOL (Millennial Media)
4.8 MoPub
4.9 RhythmOne
4.10 Telaria (Tremor)
4.11 Unity Ads
4.12 Vungle
1. Unity Integration
Download Unity Plugin
Download InMobi iOS Mediation SDK
Download InMobi Android Mediation SDK
- Open your project in the Unity editor.
-
Select Assets > Import Package > Custom Package, and then find the
aerserv-unity-plugin.unitypackage
file you downloaded. -
Make sure all the files are selected, and then click Import.
- Create a new Unity project.
- Import the AerServ Unity platform plugin.
-
Open File > Build Settings and add DemoAppStart, ASIntegration and InmobiIntegration scenes in Scenes In Build section.
- Continue to Step 2: Building the Project for iOS to build the Sample App for iOS.
- Continue to Step 3: Building the Project for Android to build the Sample App for Android.
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:
- Log on to the AerServ platform.
- Go to the 'Inventory' tab in the top navigation bar.
- Click the 'Edit' icon next to the app whose ID you wish to obtain.
- You will find the app ID at the very top of the page.
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();
}
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);
}
}
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.
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
This can be done by going to File > Build Settings and select iOS as the platform. Click build and this should start Xcode.
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.
Add the following libraries and frameworks to Target > Build Phases > Link Binary With Libraries:
- InMobiSDK.framework
- libxml2.2.tbd
- WebKit.framework
Turn bitcode off by going to Target > Build Settings > Bitcode Enabled and setting that to NO.
Add the following linker flags to Target > Build Settings > Linking > Other Linker Flags:
- -ObjC
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
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.
- iOS
- Android
- 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.
- From inside Xcode, add the Frameworks/Plugins/iOS/Frameworks/InMobiSDK/network-support/AdColony directory into Target > Build Setting > Framework Search Path.
- 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.
- 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)
- 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)
- 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>
- More info on how to set up the AdColony ad source in the AerServ mediation platform: here
- Copy the entire contents of [InMobiSDK download path]/dist/network-support/AdColony into [Project Path]/Assets/Plugins/Android/libs folder.
- 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>
- More info on how to set up the AdColony ad source in the AerServ mediation platform: here
- iOS
- Android
- 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.
- From inside Xcode, add the Frameworks/Plugins/iOS/Frameworks/InMobiSDK/network-support/AdMob directory into Target > Build Setting > Framework Search Path.
- 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
- More info on how to set up the Google AdMob ad source in the AerServ mediation platform: here
- 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.
- 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"/> - More info on how to set up the AdMob ad source in the AerServ mediation platform: here
- iOS
- Android
- 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.
- From inside Xcode, add the network-support/iOS/AppLovin directory into Target > Build Setting > Framework Search Path.
- 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)
- More info on how to set up the AppLovin ad source in the AerServ mediation platform: here
- Copy the entire contents of [InMobiSDK download path]/dist/network-support/Android/AppLovin into [Project Path]/Assets/Plugins/Android/libs folder.
- Add the following to your AndroidManifest.xml:
… <application … <activity android:name="com.applovin.adview.AppLovinInterstitialActivity" /> <activity android:name="com.applovin.adview.AppLovinConfirmationActivity" /> </application>
- More info on how to set up the AppLovin ad source in the AerServ mediation platform: here
- iOS
- Android
- 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.
- From inside Xcode, add the Frameworks/Plugins/iOS/Frameworks/InMobiSDK/network-support/Chartboost directory into Target > Build Setting > Framework Search Path.
- 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
- More info on how to set up the Chartboost ad source in the AerServ mediation platform: here
- Copy the entire contents of [InMobiSDK download path]/dist/network-support/Android/Chartboost into [Project Path]/Assets/Plugins/Android/libs folder.
- 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>
- More info on how to set up the Chartboost ad source in the AerServ mediation platform: here
- iOS
- Android
- 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.
- From inside Xcode, add the Frameworks/Plugins/iOS/Frameworks/InMobiSDK/network-support/Facebook directory into Target > Build Setting > Framework Search Path.
- 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)
- More info on how to set up the Facebook Audience Network ad source in the AerServ mediation platform: here
- Copy the entire contents of [InMobiSDK download path]/dist/network-support/Android/Facebook into [Project Path]/Assets/Plugins/Android/libs folder.
- Add the following to your AndroidManifest.xml:
…
<application>
…
<activity
android:name="com.facebook.ads.AudienceNetworkActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
</application> - More info on how to set up the Facebook Audience Network ad source in the AerServ mediation platform: here
- iOS
- Android
- 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.
- 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.
- 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.
- Add the following libraries and frameworks to Target > Build Phases > Link Binary With Libraries:
- libFlurryAds_x.x.x.a
- libFlurry_x.x.x.a
- More info on how to set up the Flurry (Yahoo) ad source in the AerServ mediation platform: here
- Copy the entire contents of [InMobiSDK download path]/dist/network-support/Android/Flurry into [Project Path]/Assets/Plugins/Android/libs folder.
- 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> - More info on how to set up the Flurry (Yahoo) ad source in the AerServ mediation platform: here
- iOS
- Android
- 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.
- From inside Xcode, add the Frameworks/Plugins/iOS/Frameworks/InMobiSDK/network-support/MillennialMedia directory into Target > Build Setting > Framework Search Path.
- 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
- 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> - More info on how to set up the ONE By AOL (Millennial Media) ad source in the AerServ mediation platform: here
- Copy the entire contents of [InMobiSDK download path]/dist/network-support/Android/MillennialMedia into [Project Path]/Assets/Plugins/Android/libs folder.
- 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>
- More info on how to set up the ONE By AOL (Millennial Media) ad source in the AerServ mediation platform: here
- iOS
- Android
- 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.
- From inside Xcode, add the Mopub source file into your project. You can drag and drop the files into your project.
- 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
- More info on how to set up the Mopub ad source in the AerServ mediation platform: here
- Copy the entire contents of [InMobiSDK download path]/dist/network-support/Android/Mopub into [Project Path]/Assets/Plugins/Android/libs folder.
- 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>
- More info on how to set up the MoPub ad source in the AerServ mediation platform: here
- iOS
- Android
- 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.
- From inside Xcode, add Frameworks/Plugins/iOS/Frameworks/InMobiSDK/network-support/RhythmOne directory into Target > Build Setting > Framework Search Path.
- 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
- Add the following entries to your application's info.plist:
<key>NSLocationWhenInUseUsageDescription</key>
<string>Some ad content may create a location.</string> - More info on how to set up the RhythmOne ad source in the AerServ mediation platform: here
- Copy the entire contents of [InMobiSDK download path]/dist/network-support/Android/RhythmOne into [Project Path]/Assets/Plugins/Android/libs folder.
- 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>
- More info on how to set up the RhythmOne ad source in the AerServ mediation platform: here
- iOS
- Android
- 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.
- From inside Xcode, add Frameworks/Plugins/iOS/Frameworks/InMobiSDK/network-support/Tremor directory into Target > Build Setting > Framework Search Path.
- Add the following libraries and frameworks to Target > Build Phases > Link Binary With Libraries:
- TremorVideoAd.framework
- More info on how to set up the Tremor ad source in the AerServ mediation platform: here
- Copy the entire contents of [InMobiSDK download path]/dist/network-support/Android/Tremor into [Project Path]/Assets/Plugins/Android/libs folder.
- 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>
- More info on how to set up the Tremor ad source in the AerServ mediation platform: here
- iOS
- Android
- 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.
- From inside Xcode, add Frameworks/Plugins/iOS/Frameworks/InMobiSDK/network-support/Unity directory into Target > Build Setting > Framework Search Path.
- Add the following libraries and frameworks to Target > Build Phases > Link Binary With Libraries:
- UnityAds.framework
- More info on how to set up the Unity Ads ad source in the AerServ mediation platform: here
- Copy the entire contents of [InMobiSDK download path]/dist/network-support/Android/Unity into [Project Path]/Assets/Plugins/Android/libs folder.
- More info on how to set up the Unity Ads ad source in the AerServ mediation platform: here
- iOS
- Android
- 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.
- From inside Xcode, add Frameworks/Plugins/iOS/Frameworks/InMobiSDK/network-support/Vungle/VungleSDK.embeddedframework directory into Target > Build Setting > Framework Search Path.
- Add the Vungle resources files from Frameworks/Plugins/iOS/Frameworks/InMobiSDK/network-support/Vungle/VungleSDK.embeddedframework/Resources to Target > Build Phase > Copy Bundle Resources.
- 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
- More info on how to set up the Vungle ad source in the AerServ mediation platform: here
- Copy the entire contents of [InMobiSDK download path]/dist/network-support/Android/Vungle into [Project Path]/Assets/Plugins/Android/libs folder.
- 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> - 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.
- 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
- Open the custom gradle file and add following line:
dependencies { ... implementation ‘com.android.support:multidex:1.0.3’ ... **DEPS** } android { defaultConfig { ... multiDexEnabled true } ... }
- 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>
Comments