2.14.0-Beta Unity SDK. Integration Guide


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 16 (Android OS 4.1). 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 9.0+ and Android OS 4.1 our SDK will just be disabled.

  • Use XCode 12 or higher.

  • CocoaPods 1.10.0 or higher

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

Mediation A/B testing

If you want to compare Appodeal's performance to another mediation, please follow this Mediation A/B testing guide

1. Download SDK

Download Appodeal SDK 2.14.0-Beta  that includes the newest Android and iOS Appodeal SDK with major improvements.

Use Appodeal SDK Manager to update to the latest Appodeal SDK from the Unity menu bar (Appodeal > Manage Appodeal SDK). More information you can find in our blog.

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. Gradle Settings 

1.1 Enable flag Custom Gradle Template in Player Settings/Publishing Settings

1.2 For (Unity 2017.4 - Unity 2019.4) versions change classpath 'com.android.tools.build:gradle:3.4.0' to 'com.android.tools.build:gradle:3.4.3' in Custom Gradle Template file. 

      For (Unity 2020.1+) versions change classpath 'com.android.tools.build:gradle:3.6.0' to 'com.android.tools.build:gradle:3.6.4' in Custom Gradle Template file. 

Preparing your Gradle build for Android 11

Android 11 changes how apps can query and interact with other apps that the user has installed on a device. For that reason make sure you're using gradle version that matches one of listed here .

2. 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 → 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. Enable the setting "Use Jetifier" (Assets → External Dependency Manager → Android Resolver → Settings).

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

6. As a result, the modules, that are required for the Appodeal SDK support, will be imported to project's mainTemplate.gradle file.

3. 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" />

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.

4. Admob configuration (if you use Admob adapter)

4.1 Add AdMob App Ids in Appodeal/AdMob Settings tool. 


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.

5. Multidex support

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

3. iOS configuration

CocoaPods 1.10.0 or higher is required. To get information about CocoaPods update please see this documentation.

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:

4. Add a valid GADApplicationIdentifier: Add  GADApplicationIdentifier into info.plist with type string as key and your app identifier as value.

iOS 14 Update

Since Appodeal SDK v2.7.3 ad networks starting to support SKAdNetwork. To get more info about it please check this documentation page.

4. Known issues

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. 

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 Store 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:

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

Data Protection Regulation (GDPR, CCPA)

Publishers need to update their apps to collect the user consent prior to initializing our SDK (Read our guide on collecting consent  here ).

1. Starting from version 2.10.0 you can use the Stack Consent Manager SDK to process and pass the user's consent:

Read our implementation  Stack Consent Manager guide  here.

Publishers need to pass the Consent result object from Stack Consent Manager SDK to the  Appodeal.initialize()  method of our SDK.

// NOTE: getConsent() - should be called after requesting user consent
Consent consent = consentManager.getConsent();
Appodeal.initialize("YOUR_APPODEAL_APP_KEY", adTypes, consent);

2. If you don't want to use the Stack Content Manager SDK, you can use the old version to pass the user's consent:

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);

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.