Unity Plugin Integration

Follow

Before You Start

  • We support Unity version 4.6.8 and up.
  • We support Android Operating Systems Version 4.1 (API level 16) and up.
  • We support XCode 9.0 and up as well as CocoaPods.
  • We suggest creating an AdTiming account and registering an Android and/or iOS app.

Note: The download, use and access to the SDK is subject to the AdTiming Mobile SDK Publisher Online Terms & Conditions. If you do not agree to the terms of AdTiming Mobile SDK Publisher Online Terms & Conditions, do not download, access, or use the SDK, or the underlying services.

Overview

This Guideline is intended for publishers who need to monetize for an Unity app.

AdTiming offers diversified and competent monetization services and supports a variety of Ad formats including Native Ad, Interstitial Ad, Banner Ad, and Incentive Video Ad. The AdTiming platform mediates AdTiming, AdMob, Facebook, UnityAds, Vungle, Tapjoy, AppLovin, AdColony, Chartboost and MoPub.

Interested in Mediation? Integrate our Rewarded Video, Interstitial Ads in your app and follow our Add Mediation Networks and Mediation Integration Guides.

 

Step 1. Add the AdTiming Unity Package to Your Project

Disclaimer: Updating the AdTiming SDK

When upgrading from older SDK versions to the AdTiming SDK 6.0.0 and above, you must download and update all mediation adapters.

Follow these steps to add the AdTiming Unity Package to your project:

  1. Download AdTiming Unity Plugin
  2. Make sure your Unity project is opened in the Unity editor
  • The AdTiming SDK is designed to work with the Android & iOS platform. The Unity Editor contains a Simulator to work with Unity code. In order to work with our plugin, you must target either an Android or iOS build to test the integration.
  1. Import the Unity package.
  • Navigate to Assets -> Import Package -> Custom Package.

WechatIMG23.png

  • Select the AdTimingUnityPlugin(Vx.x.x).unitypackage file..
  • Import all files and make sure to avoid conflicts with files. (Double-click on the extracted file; the different files will be populated automatically as shown below).

WechatIMG24.png

 

Step 2. Add the SDK to Your Project

Android

AdTiming Supports both Gradle dependenceies and menual download mechanisms to integrate our SDK. See Android SDK Integration for more infomation.

Gradle dependencies

  • Add the following to your project-level build.gradle file inside repositories section.
...
allprojects { 
repositories {
...        
jcenter()
 maven {
              url 
          }
  }
}
  • Add the following to your application-level build.gradle file inside dependencies section.
dependencies {
    implementation  'com.adtiming:mediation-sdk:6.2.1@aar'
}

 

Manual Download

1.  Download Android SDK Version 6.2.1

2. Add the SDK to Your Project

Unzip and add the AdTimingSDK-x.x.x.aar to the libs folder in your Android Project.

WechatIMG43.png

Make sure you add the following to your Gradle build file under the dependencies section:

implementation (name:'AdTimingSDK-6.2.1', ext:'aar')

 

Update AndroidManifest.xml

Configure your AndroidManifest.xml to add the following permissions into the manifest tag but outside the <application> tag.

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

 

iOS

AdTiming supports both Cocoapods and manual download for SDK integration. See iOS SDK Integration for more infomation.

CocoaPods

CocoaPods is a dependency manager for Objective-C and Swift; it automates and simplifies the SDK integration process. See the CocoaPods Guide on Getting Started and Using CocoaPods for more information.

To integrate our SDK with Cocoapods, enter the following line in your podfile:

pod 'AdTimingSDK','4.1.0'

 

Manual Download SDK Latest release

Download iOS SDK Version 4.1.0

 

Build Settings

1. Add Linker Flags

  • Add the following linker flag to the build settings at:
    Target ➣ Build Settings ➣ Linking ➣ Other Linker Flags:
-ObjC

 

2. iOS9 App Transport Security Settings

Important! In iOS9, Apple has added in controls around ‘ATS’. In order to ensure uninterrupted support for AdTiming Ad delivery across all Mediation Networks, it’s important to make the following changes in your info.plist:

3. Add in a 'Dictionary' called 'App Transport Security Settings'. Make sure you add this dictionary on the 'Top Level Key'.

4. Inside this dictionary, add a Boolean called 'Allow Arbitrary Loads' and send it to YES.

WechatIMG3.png

Please Note: Make sure that your info.plist does not contain any other exceptions besides 'NSAllowsArbitraryLoads', as this might create a conflict.

 

Step 3. Initialize the Ad Units

Before loading ads, initialize the AdTiming SDK by calling AdTiming.Agent.Init(“appKey”, initListener) with your AppKey. This is best done at the time of the app launch, and only needs to be done once. Here’s an example of how to call Init() within the Start() method of a script attached to a GameObject. At the same time, the interface AdtInitListener must be implemented to receive events of the init() call and handle it accordingly.

public void Start() 
{
AdTiming.Agent.init("Your AdTimingAppKey", new AdTimingInitListener());
}

class AdTimingInitListener : AdtInitListener
{
public void onError(string message)
{
Debug.LogError(message);
}

public void onSuccess()
{
Debug.Log("Init onSuccess");
}
}

 

isInitialized

After calling the init() method, you can also use the following code to determine whether the SDK has been successfully initialized.

// To determine the result of init()
AdTiming.Agent.isInitialized()

  

Step 4. Add Mediation Networks

Interested in Mediation? Integrate our Rewarded Video, Interstitial Ads in your app and follow our Add Mediation Networks and Mediation Integration Guides to mediate networks.

Attention! The adapter for each ad network is modularized, so you need to download and add Not Only the SDK of mediation networks you choose to work with But Also the adapters for those ad networks.

For example, if you want to integrate AdMob and Applovin through AdTiming Mediation, you need to add the AdMob Adapter, AdMob SDK and Applovin Adapter, AppLovin SDK to the libs of your project. See the Add Mediation Networks for more infomation.

Was this article helpful?
2 out of 2 found this helpful

Comments

0 comments

Article is closed for comments.