Madex
  • Android SDK
    • Installing and configuring the SDK
    • Working with advertising
    • User Consent Screen
    • Adapters for other SDKs
      • Applovin MAX SDK
      • IronSource SDK
    • Change Log
  • iOS SDK
    • Installing and configuring the SDK
    • Working with advertising
    • User Consent Screen
    • Adapters for other SDKs
      • Applovin MAX SDK
      • IronSource SDK
    • Change Log
  • Unity Plugin
    • Installing and configuring the plugin
    • Working with advertising
    • User Consent Screen
    • Adapters for other SDKs
      • Applovin MAX SDK
      • IronSource SDK
    • Change log
  • Cordova Plugin
    • Installation and configuration the plugin
    • Working with advertising
    • Change Log
  • Construct3 Addon
    • Addon installation and configuration
    • Installation and configuration of Madex mediation addon
    • Working with advertising
Powered by GitBook
On this page
  • Demo application
  • Installation
  • General description of the installation process
  • Download the Plugin
  • Configure External Dependency Manager
  • Code obfuscation
  • Add the Applovin SDK key
  • Installation check
  • Debug mode
  • Initialization
  • If the plugin is installed incorrectly
  • Connecting external ad networks to the project
  • Updating the Plugin and Managing Adapters for Other Ad Networks
  • Additional actions to increase revenue
  • Setting Up Apple ID
  • Apple Advertising Identifier (IDFA)
  • Geolocation data collection
  • Other plugin settings
  • User Consent Screen
  • Possible errors
  1. Unity Plugin

Installing and configuring the plugin

Integration Guide.

PreviousUnity PluginNextWorking with advertising

Last updated 8 days ago

Release version 1.4.1 | Release date 05/15/2025

Minimum requirements:

  • Use Unity 2018.3+ version.

  • Use Android API level 22 (Android OS 5.1) and above.

  • Use iOS 13.0 and above.

  • Use Xcode 13 and above.

Demo application

Use our demo application as an example.

Installation

General description of the installation process

To install the Unity Plugin, you will need:

  • Check out the demo application

  • Download and import the latest version of the plugin into your project.

  • Configure External Dependency Manager

  • Check the installation correctness by initializing the plugin with debug mode enabled

Download the Plugin

  1. Import the plugin into your project using the Custom Package option. The plugin includes the External Dependency Manager. You may not import it if it has already been installed in the project.

Configure External Dependency Manager

External Dependency Manager is a plugin for resolving dependency conflicts

To resolve dependency conflicts in your application, follow these steps:

  1. Navigate to Build Settings → Android → Player Settings → Publishing settings

  2. For Unity 2018.4 - Unity 2019.2: add the Custom Gradle Template flag For Unity 2019.3 or newer: add the Custom Main Gradle Template flag

  3. Go to External Dependency Manager → Android Resolver → Settings

  4. Enable the Patch mainTemplate.gradle setting

  5. Enable the Use Jetifier setting

  6. Select the Force Resolve option in External Dependency Manager → Android Resolver → Force Resolve

  7. If the dependencies are installed successfully, you will see the Resolution Succeeded alert

Code obfuscation

If code obfuscation is enabled in your application, then add the following text to the end of the file proguard-rules.pro:

-keep class sspnet.tech.**.* { *; }

Add the Applovin SDK key

If you are using an adapter for Applovin, then follow these steps for the platform you are working with// Some code

If you are using an adapter for Applovin, then add the following <meta-data> element to your AndroidManifest.xml inside the <application> element:

<meta-data android:name="applovin.sdk.key"
           android:value="APPLOVIN_SDK_KEY"/>

Add the following key to Info.plist:

<key>AppLovinSdkKey</key>
<string>APPLOVIN_SDK_KEY</string>

Installation check

To make sure that the plugin is installed correctly, you will need to enable debug mode and initialize the plugin.

Debug mode

In debug mode the plugin logs errors and events. It is disabled by default.

Use the EnableDebug method to enable debug mode.

Madex.enableDebug(true);

Initialization

  1. Inherit the class that will work with the SDK from the interface for tracking SDK initialization.

class YourClassName : IInitializationListener {    
    public void OnInitializeSuccess()
    {
        // Called when the SDK is installed correctly
    }
    
    public void OnInitializeFailed(AdException error)
    {
        // Called when an error occurred during SDK installation
        // Using AdException error, you can get detailed information about the error
    }
}
Madex.initialize("publisher_id");

If the plugin is installed correctly, you will see the following message in the console.

Call to Initialize on not supported platform. To test advertising, install your application on the Android/iOS device.

This message indicates that the plugin is installed correctly, but ad display is only possible after building the application for Android/iOS.

We recommend that you don't disable debug mode until you finish working with ads.

If the plugin is installed incorrectly

In case of errors, we recommend clearing the External Dependency Manager cache and selecting Force Resolve in External Dependency Manager → Android Resolver.

If this doesn't help, try installing the plugin in a clean project. If the plugin is installed correctly, try to debug errors in your project.

If you are unable to install the plugin correctly and the above steps didn't lead to successful initialization, please contact support.

Connecting external ad networks to the project

If you are using Madex mediation (working with other ad networks through our plugin):

  1. Import the file into the project received from the Madex account manager (drag and drop the file into the project or use the Custom Package option)

  2. Select the Force Resolve option in External Dependency Manager → Android Resolver → Force Resolve

Updating the Plugin and Managing Adapters for Other Ad Networks

Check for an update before building the app.

The Madex Unity Plugin provides a convenient interface for updating the plugin and managing ad networks. In the Dependency Manager window, you can update the plugin to the latest version and choose the ad networks you want to use.

Additional actions to increase revenue

Setting Up Apple ID

It is determined automatically, but in some cases, Madex Unity Plugin may not be able to determine it.

If Madex Unity Plugin did not determine your App ID, you will see the following message in the console.

AppStore ID is nil. You must set AppStore ID manually.

In this case, you need to set the ID manually.

To set up Apple ID, use the setCustomParams method.

Madex.setCustomParams("appStoreAppID", "apple_id")

Apple Advertising Identifier (IDFA)

For more effective targeted advertising and increased revenue, you can collect the Apple device advertising identifier and pass it to Madex Unity Plugin.

To enable IDFA collection, check the following checkboxes in the plugin setting:

NSUserTrackingUsageDescription - Permission to collect the advertising identifier (Advertising Identifier IDFA).

Geolocation data collection

To make targeted ads work more effectively and increase revenue, you can collect in app data about a user's exact and/or approximate geolocation, and feed it into the Madex Unity Plugin.

To enable geolocation data collection on Android, check the following checkboxes in the plugin settings:

ACCESS_COARSE_LOCATION - Permission to collect approximate user geolocation.

ACCESS_FINE_LOCATION - Permission to collect precise user geolocation.

To enable geolocation data collection on iOS, check the following checkboxes in the plugin settings:

NSLocationWhenInUseUsageDescription - Permission to collect user geolocation

Other plugin settings

User Consent Screen

In order to comply with the requirements of the app store and the laws governing the collection, processing and use of user's personal data, it is required to obtain his consent to the above actions.

Usually, the user's consent is obtained on a special screen when the application is first launched — consent-screen.

The Madex Unity Plugin implements such a screen, you can add and configure it using the Content Manager library.

You can find out more about its installation and configuration in the corresponding section.

Possible errors

Library not loaded: @rpath/MadexSDK.framework/MadexSDK

Download the latest version of the plugin at the .

You can copy your APPLOVIN_SDK_KEY in the "Keys" section of your Applovin.

You can copy your APPLOVIN_SDK_KEY in the "Keys" section of your Applovin .

Use the code below to initialize the plugin in your project. You can copy your publisher_id in the "Settings" section of your Madex .

Done! The plugin is installed, you can proceed to .

We also recommend to take a look at the installation and initialization in the .

For more effective targeted advertising and increased revenue, Madex Unity Plugin collects and transmits user data - a unique numerical application identifier from the Apple AppStore.

Replace apple_id with your App ID from the AppStore developer account. You can find it on the app page in the .

The error occurs due to the peculiarities of xcframework linking in Unity. In order to fix the error, you need to download MadexPostProcessBuildiOS.cs from this and place it in the scripts folder or in another folder for your scripts.

link
personal account
personal account
personal account
setting up ads
demo application
App ID
developer account
User Consent Screen
link
GitHub - MadexTech/madex-unity-demoGitHub
Logo
Clearing the External Dependency Manager cache on Mac OS
Using an Apple ID in the AppStore Connect