Get Started

Release version: 2.14.4 | Release date: 26.08.2021

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

  • iOS 10.0 or higher. 

  • Use XCode 12.5 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).

HIGH-LEVEL Integration steps:
     Step 1: Import SDK
     Step 2: Project configuration
     Step 3: Initialize SDK
     Step 4: Configure ad types  

Use these instructions to integrate the Appodeal SDK with your application. 


You can use our  demo app  as a reference project.


Step 1. Import SDK

1.1 Download Appodeal SDK 2.14.4  that includes the newest Android and iOS Appodeal SDK with major improvements.


1.2 To import the Appodeal Unity plugin, double-click on the Appodeal-Unity-Plugin-2.14.4-26.08.2021.unitypackage , or go to   Assets Import Package Custom Package . Keep all the files in the Importing Package window selected, and click Import .

Use Appodeal SDK Manager to update to the latest Appodeal SDK from the Unity menu bar (Appodeal → Manage Appodeal SDK), supports Unity 2018.3 or higher. More information you can find in our blog.

Step 2. Project configuration

2.1 Android configuration

1. Gradle Settings 

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 .

  1. Go to Player Settings Publishing Settings and enable Custom Base Gradle Template flag.
  2. Go to AssetsPlugins Android baseProjectTemplate.gradle, open the file and change classpath 'com.android.tools.build:gradle:3.6.0' to 'com.android.tools.build:gradle:3.6.4'.

    If you have already been using gradle plugin 4.0.1 version or higher, no change is required.

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 for Unity 2017.4 - Unity 2019.2 versions or Custom Main Gradle Template for Unity 2019.3 or higher (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

For the Appodeal SDK to work correctly, you need to add permissions to AndroidManifest.
We distinguish 2 sets of permissions: required permissions, without which the Appodeal SDK cannot work, and optional permissions, which are needed to improve targeting.For more information about the purpose of each of the permissions, see the  FAQ  section.

  • 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 and optional permissions  are already added to the Appodeal Unity Plugin. If you don't want to use optional permissions, go to  Plugins → Android → appodeal.androidlib  , open AndroidManifest.xml and remove them from there.

According to  Google policy , location permissions may only be requested to provide features beneficial to the user and relevant to the core functionality of the app. You cannot request access to location data for the sole purpose of advertising or analytics.

If you are not using location for the main functions of your app

  • Remove location permission in your app by adding the following code to AndroidManifest.xml
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"
	tools:node="remove" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"
	tools:node="remove" />
  • Update the app on Google Play. During the publishing process, make sure there are no location warnings in Google Play Console.

If you are using location for the main functions of your app

  • Fill out the Location permissions declaration form in  Google Play Console . You can read more about the declaration form  here .
  • Update the app on Google Play. During the publishing process, make sure there are no location warnings in Google Play Console.

Some networks and 3rd party dependencies (related to network dependencies) can include their own permissions to the manifest. If you want to force remove such permissions you can refer to this guide.

4. Request runtime permissions in Android Marshmallow (API 6.0+)

Extend your class with IPermissionGrantedListener :

YourClassName : IPermissionGrantedListener;
Call the following method within the  Awake()  method of the class that loads first:
Appodeal.requestAndroidMPermissions(this);
Use the following callbacks to operate with answers on requesting  WRITE_EXTERNAL_STORAGE  and  ACCESS_COARSE_LOCATION  permissions in Android Marshmallow and higher:
public void writeExternalStorageResponse(int result) { 
  if(result == 0) {
    Debug.Log("WRITE_EXTERNAL_STORAGE permission granted"); 
  } else {
    Debug.Log("WRITE_EXTERNAL_STORAGE permission grant refused"); 
  }
}
public void accessCoarseLocationResponse(int result) { 
  if(result == 0) {
    Debug.Log("ACCESS_COARSE_LOCATION permission granted"); 
  } else {
    Debug.Log("ACCESS_COARSE_LOCATION permission grant refused"); 
  }
}

5. Disable permissions check

You can disable the check of optional permissions to avoid displaying in the logs that the permissions were not granted.

To disable toast message "ACCESS_COARSE_LOCATION permission is missing", use the following method before the SDK initialization:

Appodeal.disableLocationPermissionCheck();
To disable toast-messages " WRITE_EXTERNAL_STORAGE permission is missing ", use the following method before the SDK initialization:
Appodeal.disableWriteExternalStoragePermissionCheck();

Toast messages are displayed only when the test mode for the Appodeal SDK is enabled

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.

6. 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.
  • If you are using Unity 2019.3 or higher go to Player Settings → Publishing Settings → Other Settings and change Minimum API Level to 21 or higher.

2.2 iOS configuration

1. 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 → 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 → AppodealDependencies.xml file.

2. Add SKAdNetworkIds

Ad networks used in Appodeal mediation support conversion tracking using Apple's SKAdNetwork , which means ad networks are able to attribute an app install even when IDFA is unavailable. To enable this functionality, you will need to update the SKAdNetworkItems key with an additional dictionary in your  Info.plist .

  1. Select Info.plist in the Project navigator in Xcode
  2. Click the Add button (+) beside a key in the property list editor and press Return
  3. Type the key name SKAdNetworkItems
  4. Choose an Array  type
  5. Add Key-Value pair where the key is SKAdNetworkIdentifier and the value is the ad network identifier

There is SKAdNetworks IDs in  Info.plist format:

3. Configure App Transport Security Settings

In order to serve ads, the SDK requires you to allow arbitrary loads. Set up the following keys in info.plist of your app:

  1. Go to your info.plist  file, then press  Add+ anywhere in the first column of the key list.
  2. Add App Transport Security Settings key  and set its type to  Dictionary in the second column.
  3. Press Add+  at the end of the name  App Transport Security  Settingske y 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. Other feature usage descriptions

To improve ad performance the the following entries should be added:

  1. GADApplicationIdentifier - When including AdMob in your project you must also add your AdMob app ID to your info.plist . Use the key GADApplicationIdentifier with the value being your AdMob app ID. (Will be added automatically during the next step “Admob Configuration”.) 
  2. NSUserTrackingUsageDescription - As of iOS 14 using IDFA requires permission from the user. The following entry must be added in order to improve ad performance.
  3. NSLocationWhenInUseUsageDescription - Entry is required if your application allows Appodeal SDK to use location data.
  4. NSCalendarsUsageDescription - Recommended by some ad networks.

<key>GADApplicationIdentifier</key> 
<string>YOUR_ADMOB_APP_ID</string>
<key>NSUserTrackingUsageDescription</key>
<string><App Name> needs your advertising identifier to provide personalised advertising experience tailored to you</string>
<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>

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. 

2.3 Admob configuration 

Only if you use AdMob or A4G adapter.

Add AdMob App Ids from the Unity Menu bar Appodeal → Appodeal Settings tool for each platform. 




AdMob App ID is the unique ID assigned to your app. 
To find the AdMob App ID in your AdMob account, go to Apps → your application → app settings and copy the AdMob App ID. 

For more information about Admob sync check out our FAQ.


                                                                                                                                                                                                                                                                                            

Step 3. 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 .


Step 4. Configure ad types

For completing implementation integrate showing of ad types to your application.

Full-screen ad that engages users with a captivating video.


User-initiated ads where users can earn in-app rewards in exchange for viewing a video ad.


Traditional ad format that neatly places a small ad at the top or bottom of the screen.


Medium-size ads that appear within in-app content the same as banner ads.