Unity
This document provides instructions on how to integrate the Mintegral SDK for Unity developers. The Mintegral SDK for Unity Plugin provides six different ads formats: Native, App Wall, Rewarded Video, Interstitial, Interstitial Video and Interactive.
Obtain SDK And Mintegral Unity Plugin
Get the Android SDK download link in Mintegral Android SDK Integration Document,and add the required SDK package, AndroidManifest, ProGuard configuration rules and other configurations according to the description of the document.
Get the iOS SDK download link in Mintegral iOS SDK Integration Document, and add the required SDK packages according to instructions.
Download the latest Unity plugin here.And import all the files in the Unity Plugin into your project. you can also refer to the sample in the link. Please note that if you updating the latest plugin requires using the latest SDK at the same time.
Unity sample view here. Note: The android/ios sdk in unity sample is not the latest release,Please update the SDK in time via android/ios doc
MTGSDK Initialization
Please call MTGSDK integration method in the below codes when your program bengin run. passing in AppId and Appkey, and ApplicationId. MTGSDK will get the configuration info from the server.
Mintegral.initMTGSDK (MTGSDKAppID,MTGSDKAppKey);Instruction For EU-GDPR Version
1.To set up the on and off switch to allow SDK to retrieve users' infomationyou will need to adopt the below code before SDK initialization. 1 means to give authorization and 0 means to decline authorization.
Mintegral.setConsentStatusInfoType(int GDPR_key);2.Get the switch status set by the user.
Mintegral.getConsentStatusInfoType();CCPA Preparation
On June 28, 2018, the State of California (“California“) issued the California Consumer Privacy Act 2018 (“CCPA”), which aims to strengthen consumer privacy and data security protection, which will be effective On January 1st, 2020. For California users, you can use the setDoNotTrackStatus API to limit data processing based on the user's selection. After the setup is completed, Mintegral will no longer show personalized recommended ads to the user based on the their device information, and will not sync the device information to other third-party partners. The API is available in SDK version 5.8.7 and above.
API Introduction
To set up the on and off switch to allow SDK to retrieve users' information,you will need to adopt the below code before SDK initialization.
Banner
Banner ads are rectangular image or text ads that occupy a spot within an app's layout. They stay on screen while users are interacting with the app, and can refresh automatically after a certain period of time.
Initialization of Ad Unit
Please refer to the part of MTGSDK initialization to see how to initialize MTGSDK. When initializing, you need to pass in your unit id.
Create the Banner
Below is the complete list of BannerAdPosition:
Destroy the Banner
Related CallBack Event
Native
Native Ads is currently one of the most popular Ads types. The Mintegral SDK will report back creative material information to your app. You will then be able to assemble and adjust the creative elements as needed to ensure the creative material is compatible to your product style and in turn create the best user experience.
Initialization of ad unit
Please refer to the part of MTGSDK initialization to see how to initialize MTGSDK. When initializing, you need to pass in your Placementid and unit id of the corresponding ad slot.
Note: 1.The current plug-in does not support NativeVideo format, so you need to choose the MTGAD_TEMPLATE_BIG_IMAGE template .
2.The adCategory parameter controls the ad category. If there is no special requirement for the ad type, please fill in the MTGAD_CATEGORY_ALL (or the number 0).
3.AutoCacheImage parameter controls whether to automatically cache images, only for iOS platform.
4.LibMTGNativeAdBridge.a supports bitcode mode, only for the iOS platform.
PreLoad Ads
Load Ads
Registered native ads for Android platform
Unregistered native ads for Android platform
Related Callback Event
Rewarded Video
Rewarded Video is one of the best performing Ads formats on the Mintegral platform. Users can get rewards by watching a video Ads. The creativity and attention-grabbing nature of the video content attracts users to download the advertised product.
Rewarded Video sample:
Initialization of Ad Unit
Please refer to the part of MTGSDK initialization to see how to initialize MTGSDK. When initializing, you need to pass in your unit id of the corresponding ad slot.
Load Ads
Set the corresponding ad unit id for video ads.
Show Ads
Display the ads before judging whether it is downloaded or not; if failed. it won't be displayed. Reward Id corresponds to the Mintegral system background configuration of the reward information, which was created in the dashboard. User Id is the Identifier for the server-side callback, if it is client-callback mode, you can not use it.
Clear the local cache
Clear the local cache of the video file.
Related CallBack Event
AndroidManifest.xml Configuration
HardwareAccelerated
Add these codes "android:hardwareAccelerated=ture" in tab of application:
Interstitial Video
Interstitial Video ads are upgraded versions of Static ads that show users a full-screen or half-screen video, increasing user interest through more engaging videos. Interstitial Video sample:
Initialization of Ad Unit
Please refer to the part of MTGSDK initialization to see how to initialize MTGSDK.
Load Ads
Show Ads
Custom the reward alert dialog display text.
You‘d better call setAlertDialogText before call load method.
Set the reward alert dialog mode for interstitial video.
Please call setIVRewardEnable before call load method.
MTGIVRewardMode as below shown:
Related CallBack Event
AndroidManifest.xml Configuration
Static Interstitial
The interstitial ad will display a large image ad on the screen, and the user can close the ad by clicking the close button. MIntegral has launched a new Interstitial Video ad type that offers better visuals and experience than regular Interstitial ads.
Interstitial sample:
Initialization of Ad Unit
Please refer to the part of MTGSDK initialization to see how to initialize MTGSDK. When initializing, you need to pass in your Placementid and unit id of the corresponding ad slot. The "adCategory" controls the advertising app category. If no special requirement here, please set it as MTGInterstitialVideo_AD_CATEGORY_ALL(or figure "0").
Load Ads
Show Ads
Related CallBack Event
AndroidManifest.xml Configuration
Interactive
Interactive ad is a new ad format launched by Mintegral, in which users can instantly experience any app or game in the highest quality possible, before downloading the app. This greatly improves the possibility of conversion. The current ads creatives are mainly interactive videos and HTML5 files.
Interactive sample:
Initialization of ad unit
Please refer to the part of MTGSDK initialization to see how to initialize MTGSDK.
Load Ads
Show Ads
Related CallBack Event
AndroidManifest.xml Configuration
FAQs
1.Why call the preload method?
A: Preload: You can cache the ads data before display then use the cache data for the next impression. This helps to reduce ads' loading time, improve user experience and increase your revenue.
2.Why do the ads jump so slowly for the first time?
A: The ads will go through several layers of 302 redirects before reaching the final URL. The NativeHandler is notified when the page jump is complete and developers can setup a loading dialogue at this time.
3.Why are no ads returned sometimes?
A: Please check whether the AppId, AppKey, UnitId and PlacementId are correct; and then check the offers status in the Mintegral dashboard.
4.Why are there two different languages in the offers?
A: MTGSDK identifies the user's network IP. So the corresponding area language will be adopted. Also, since English is a universal language there will usually be two languages: English and the local language.
5.Can we change the language of the install button in the AppWall?
A: Unfortunately, we only support English at the moment.
6.Why can't the ads be downloaded sometimes?
A: Check your appstore network connection; check whether your Apple account is in alignment with the area you are connected to.
7.What is the amount of offers for a specific area?
A:The number of offers for a specific area is equal to the total number of offers that is promoted in this area. So even if the ad requests exceed the total offer amount, the number won't increase.
8.How long will Native Ad image resources be cached?
A:They will be cached for 7 days.
Change Log
Version
Change Log
Publish Date
4.0.0
Based on Android 12.1.51,ios 6.1.0, support multi-template feature
Mar 23,2020
3.0.0
Based on Android 10.1.9,iOS 5.8.4, added Banner and aar integration for Android platform
Dec 23,2019
2.4.4
Based on Android9.12.0,ios5.3.3, fix internal api changes in Android SDK;
July 19,2019
2.4.3
Based on Android9.11.0, ios5.3.3, add onInterstitialVideoPlayCompleted,onInterstitialVideoEndCardShowSuccess, onRewardedVideoPlayCompleted,onRewardedVideoEndCardShowSuccess;
May 21,2019
2.4.2
Based on Android 9.9.0, iOS 5.0.0, add the onInterActiveMaterialLoaded method and onInterActivePlayingComplete method of InterActive ad;
Mar 21,2019
2.4.1
Based on Android 9.0.2, iOS 4.5.0, fix the listener method name of InterstitialVideo in Android, increase the onLoadSuccess method of IV and RV;
Oct 23,2018
2.4.0
Based on Android 9.0.0, iOS 4.3.0, add InterActive ads, increase GDPR settings to get status methods
Aug 23,2018
2.3.0
Replace the mintegral package name. Support InterstitialVideo
Jul 03,2018
2.2.0
Based on Android 8.11.2, iOS 3.8.0, support GDPR function
May 15,2018
2.1.0
Refactoring Mintegral UnityPlugin ,Support Native Ads Type
Feb 06,2018
2.0.0
Refactoring Mintegral UnityPlugin (Do not Native Type Support temporarily)
Jan 12,2018
1.3.0
add delegate "NativeAdImpressionWithType" for MTGNativeAdsUnity
Nov 20,2017
1.2.6
fixed C# API bug about isReady
Nov 08,2017
1.2.5
Update C# API ,AndroidBridge for muli-RV-UnitID
Oct 30,2017
1.2.4
Fix some bugs
Sep 22,2017
1.2.3
AndroidBridge only support for V8.3.X
Sep 16,2017
1.2.2
just only modify the UnityPlugin-Android, add Modified Mintegral_UnityAndroidBridge.jar, only for Android SDK 8.1.43 and above
Aug 02,2017
1.2.1
just only modify the UnityPlugin-Android, add a parame for the function ShowViewInUnity(), by which developer can pass userId
Jul 13,2017
1.2.0
removed all the sdk,so developer should import current stable SDK manually.
Jun 23,2017
1.1.2
optimize the Native(iOS); UnityPlugin1.1.2 just support MTGSDK-iOS 1.6.2.MTGSDK-Android 8.1.10 and above
Feb 15,2017
1.1.1
optimize the RewardWall(iOS); UnityPlugin1.1.1 just support MTGSDK-iOS 1.6.1.MTGSDK-Android 8.1.10
Feb 15,2017
1.1.0
providing Android-Plugin for ads.AppWall.RewardVideo.OfferWall.Interstitial
Jan 11,2017
1.0.0
providing IOS-Plugin for native ads.AppWall.RewardVideo.OfferWall.Interstitial
Nov 09,2016
Last updated
Was this helpful?