2.10.1-Beta Unity SDK Integration Guide

Publishers need to pass the boolean consent flag(with 'false' meaning that the user declined to give the consent) to the Appodeal.initialize() method of our SDK.

Appodeal.initialize(YOUR_APPODEAL_APP_KEY, adTypes, consentValue);

Integrate SDK 

You can use our demo app as a reference project.

Minimum OS requirements:

  • Unity 2017.4 (Api Compatibility Level - Experimental (.NET 4.6 Equivalent) or 2018.3+
  • Android API level 14 (Android OS 4.0). You can include Appodeal SDK in apps with lower minSdkVersion.
  • iOS 9.0 or higher. You still can integrate the Appodeal SDK into a project with a lower value of minimum iOS version. On the devices that don’t support iOS 8.0+ our SDK will just be disabled.
  • Use XCode 9.0 or higher - without bitcode (with XCode 11+ bitcode is supported).

Unity 2017.4

If you are using Unity 2017.4, you need to change Scripting Runtime Version in Player Settings > Other Setting on Experimental (.NET 4.6 Equivalent).


1. Download SDK

Download Appodeal SDK 2.10.1-Beta that includes the newest Android and iOS Appodeal SDK with major improvements, asynchronous ads loading support.

Starting from SDK 2.9.0 we don’t separate versions to MaxDex and NoDex, instead of them we provide a single version that can be easily integrated via Unity Asset Store or via direct downloading.


2. Android configuration

1. External Dependency Manager (Play Services Resolver)

Appodeal plugin includes Play Services Resolver package.  You need to complete these following steps to resolve Appodeal's dependencies:

1. After the import Appodeal Unity Plugin, in the Unity editor select File → Build Settings → Android.

2. Add flag Custom Gradle Template (Build Settings → Player Settings → Publishing settings)

3. Enable the setting Patch mainTemplate.gradle (Assets → External Dependency Manager → Android Resolver → Settings) 

4. Then run Assets → External Dependency Manager → Android Resolver and press Resolve or Force Resolve.

5. As a result, the modules, that are required for the Appodeal SDK support, will be imported to project's mainTemplate.gradle file. You can edit them or add other modules in the Assets → Appodeal → Editor → AppodealAdapterDependencies.xml file.

If you're using AndroidX in your app, make sure you have enabled Jetifier


2. Configure AndroidManifest.xml

  • Add required permissions to your AndroidManifest.xml file under manifest tag:

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />

  • Add optional permissions to your AndroidManifest.xml file under manifest tag to improve ad targeting:

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />

  • Add the following permissions necessary for the Mintegral network to work correctly to your AndroidManifest.xml under manifest tag:
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/> <!--optional-->

All the required AndroidManifest.xml tags are already added to the Appodeal Unity Plugin. If you don't want to use optional permissions, go to Plugins → Android → Appodeal, open AndroidManifest.xml and remove them from there.

3. Admob configuration

If you use Play Services version 17 and up, add the <meta-data> tag to AndroidManifest file. 

<manifest>
	<application>
		<meta-data
			android:name="com.google.android.gms.ads.APPLICATION_ID"
			android:value="[ADMOB_APP_ID]"/>
	</application>
</manifest>

Make sure to add Privacy Policy to your app on Google Play that links to Appodeal's Privacy Policy to avoid violating Google Play Developer Distribution Agreement.

4. Multidex support

  • If you are using Unity 2018 and versions below you need to add multidex support to your project. Follow this guide to add Multidex.

If you're using AndroidX in your app, you need to change - android:name="android.support.multidex.MultiDexApplication" from AndroidManifest (Assets>Plugins>Android>appodeal) to android:name="androidx.multidex.MultiDexApplication" and add dependency to mainTemplate.gradle - implementation 'androidx.multidex:multidex:2.0.1'

Unity 2019.3

If you are using Unity 2019.3 you need to remove - android:name="android.support.multidex.MultiDexApplication" from AndroidManifest (Assets>Plugins>Android>appodeal).


3. iOS configuration

1. External Dependency Manager (Play Services Resolver)

Appodeal plugin includes External Dependency Manager package.  You need to complete these following steps to resolve Appodeal's dependencies:

1. After the import Appodeal Unity Plugin, in the Unity editor select File → Build Settings → iOS.

2. During build a project the modules, that are required for the Appodeal SDK support, will be imported to your project. You can edit them or add other modules in the Assets → Appodeal → Editor → AppodealAdapterDependencies.xml file.

2. Adding keys to info.plist:

Set up the following keys in info.plist of your app:

In order to serve ads, the SDK requires you to allow arbitrary loads.

1. Go to your info.plist file, then press Add+ anywhere in the first column of the key list.

2. Add App Transport Security Settingskey and set its type to Dictionary in the second column.

3. Press Add+ at the end of the name App Transport Security Settingskey and choose Allow Arbitrary loads. Set its type to Boolean and its value to Yes.

You can also add the key to your info.plist directly, using this code:

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>
4. Add a valid GADApplicationIdentifier: Add GADApplicationIdentifier into info.plist with type string as key and your app identifier as value.
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~1458002511</string>

3. Build Settings:

Unity 2019.3

If you are using Unity 2019.3 you need to complete these following steps:

  • add FBSDKCoreKit.framework, GoogleUtilities.framework, FBLPromises.framework, nanopb.framework to Build Phases > Embed Frameworks for Unity-iPhone target

4. Known issues

Facebook Unity SDK

If you are using the Facebook Unity SDK in the project, you need to add flag true in the Build Settings > Apple Clang - Language - Modules > enable modules (C and Objc-C),

1. AdColony presentation issue

AdColony always checks, if the key window’s rootViewController matches the passed rootViewController. Otherwise, Adcolony fails to present the ad. If your app has multiple independent windows, you can get a message with this or similar text:

AdColony [*** ERROR ***] : AdColony has ads, but could not display them. AdColony was unable to find the currently visible UIViewController for your app. Please ensure that your key UIWindow has a rootViewController.

It means, that the rootViewController that was used in showAd, doesn't belong to the first window in the array. 

2. GoogleMobileAds issue

GoogleMobileAds will play music during ad downloading, if someone wants to change UserAgent on their custom UserAgent. The issue was detected in v. 7.33.1. This problem has not appeared in newer versions of the Google SDK (starting with v. 7.35.0), but then ads almost stop filling. 

Since GoogleMobileAds were updated to 7.42.0, you should add GADApplicationIdentifier in your's Info.plist. If you forget about it your application will fail with error:

The Google Mobile Ads SDK was initialized incorrectly.

5. Initialize SDK

Before starting to load ads, you need to initialize the Appodeal SDK, as follows:

1. Import the namespaces:

using AppodealAds.Unity.Api;
using AppodealAds.Unity.Common;

2. Add the following code within the Start() method of your main scene’s MonoBehavior: 

Appodeal.initialize("YOUR_APPODEAL_APP_KEY", adTypes, consentValue);
consentValue is boolean, with 'false' meaning that the user declines to give the consent. Read our guide on collecting consent here.

Make sure to replace "YOUR_APPODEAL_APP_KEY" with the actual app key.

Use the type codes below to set the preferred ad format:

  • Appodeal.INTERSTITIAL for interstitial.
  • Appodeal.REWARDED_VIDEO for rewarded videos.
  • Appodeal.NON_SKIPPABLE_VIDEO for non-skippable videos.
  • Appodeal.BANNER for banners.
  • Appodeal.MREC for 300*250 banners.


Please note:

Ad types can be combined using "|" operator. For example, Appodeal.INTERSTITIAL | Appodeal.REWARDED_VIDEO.

Non-skippable and rewarded videos cannot be used simultaneously. If you are not sure, which ad formats would suit you the best, check out our FAQ.


Publish your app

iOS publication

1. Update Your IDFA Settings

When you submit your application to the App you need to update its "Advertising Identifier (IDFA)" settings in order to comply with Apple advertising policy.

1. Go to the Advertising Identifier section.

2. Set Yes on the right panel.

3. Tick Serve advertisements within the app.

4. Tick confirmation box under Limit Ad tracking setting in iOS.

2. Add usage descriptions to info.plist

If your app gets rejected by the App Store due to missing usage descriptions, add them to your info.plist file:

<key>NSLocationWhenInUseUsageDescription</key>
<string><App Name> needs your location for analytics and advertising purposes</string>
<key>NSCalendarsUsageDescription</key>
<string><App Name> needs your calendar to provide personalised advertising experience tailored to you</string>

It's done!

You are ready to use Appodeal and implement ad types. If you have any questions, check out our FAQ or contact the support team.