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.
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
- 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).
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.
2. Configure AndroidManifest.xml
- Add required permissions to your AndroidManifest.xml file under manifest tag:
- Add optional permissions to your AndroidManifest.xml file under manifest tag to improve ad targeting:
- Add the following permissions necessary for the Mintegral network to work correctly to your AndroidManifest.xml under manifest tag:
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
<meta-data>tag to AndroidManifest file.
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'
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:4. Add a valid GADApplicationIdentifier: Add GADApplicationIdentifier into info.plist with type string as key and your app identifier as value.
3. Build Settings:
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:
UIViewControllerfor your app. Please ensure that your key
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:
5. Initialize SDK
Before starting to load ads, you need to initialize the Appodeal SDK, as follows:
1. Import the namespaces:
2. Add the following code within the
Start() method of your main scene’s MonoBehavior:
consentValueis boolean, with 'false' meaning that the user declines to give the consent. Read our guide on collecting consent here.
Use the type codes below to set the preferred ad format:
Appodeal.REWARDED_VIDEOfor rewarded videos.
Appodeal.NON_SKIPPABLE_VIDEOfor non-skippable videos.
Appodeal.MRECfor 300*250 banners.
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
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: