The MVP Unity Developer Hub

Welcome to the MVP Unity developer hub. You'll find comprehensive guides and documentation to help you start working with MVP Unity as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Unity SDK Integration

Current SDK Version: 3.4.1

Introduction

This guide is intended for developers who are integrating the FairBid SDK with a Unity app. After you have integrated the SDK, you must choose the relevant ad format and follow the steps for implementing that format.

Prerequisites

  • Android 4.1 (API level 16)+ (when building for Android)
  • iOS 9.0+ (when building for iOS)
  • Unity 2017 LTS or later

🚧

Important

  • The FairBid Unity SDK can only build iOS projects from a Mac - you cannot build your Xcode project on Windows.
  • All Fyber SDKs and supported mediated networks work in conjunction with Android's 64-bit architecture.

Integration

Removing Current Plugin

If you are updating the Plugin, first make sure there is no trace of the previous version of the FairBid Plugin.

Simply remove the FairBid folder. This is a fail-safe way to ensure no legacy file is left behind:

If your current FairBid Plugin pre-dates version 3.4.1 refer to Migrating from the Old to New Structure to ensure it is correctly removed.

Importing New Plugin

  1. Download the FairBid SDK
  2. Unzip the downloaded files
  3. Add the FairBid.unitypackage to your open Unity project.

You can do this by either double-clicking the file, or following the steps outlined in the below screenshot:

Migrating from Old to New Structure

Before FairBid Unity Plugin 3.4.1, the plugin resources would be spread out across unity folders:

Starting from version 3.4.0 we have moved all relevant resources inside a FairBid folder.

This makes it more convenient when updating the plugin and helps maintain the organization of the project folders.

If you are moving from a previous version, make sure to delete all traces of the FairBid plugin before importing the new package.

These are all the files you must delete:

This prevents build issues due to file duplications.

Moving forward, the update process should be seamless. For more information refer to the Integration section.

Android Specific Setup

Enable Gradle Template

For Android builds, it is highly recommended to enable the Gradle template.

This allows you to configure your build to include specific dependencies, build properties and other compilation options in a seamless way.

To do this, select the “Custom Gradle Template” box in Publishing Settings.

This creates a file called mainTemplate.gradle under Assets/Plugins/Android.

Installing Google Play Services

The Google Play Services SDK must be added to your project.
Make sure you have a mainTemplate.gradle file in your project. Refer to Enable Gradle Template.

Then add the following snippet to that file:

dependencies {
    implementation 'com.google.android.gms:play-services-ads:17.0.0' 

}

Java Version Compatibility

Starting from FairBid SDK 3.0.0, if you support android SDK below 26 and you are using Unity Editor lower than 2018 LTS (2018.4.20f1), you must declare the source and target compatibility of your project to Java 1.8.

Make sure you have a mainTemplate.gradle file in your project.

There, add the following snippet

android {
    ...
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    ...
}

Historically, Android projects have been using Java 1.7 since it was the surest way to ensure compatibility across Android versions.

Android Studio has been supporting partial compatibility with Java 1.8 since version 3.0.0. As some of our partners begin moving to 1.8, we follow suit.

It simply allows our team (and our partners) to leverage some new features of the Java language with no implications on runtime/API compatibility.

However, it enforces the same type of declaration in the projects integrating FairBid SDK.

Building for Android X

If you, or any of your integrated mediation networks use AndroidX libraries, you can update your build to ensure compatibility.

To use androidx-namespaced libraries in a new project, you must set the compile SDK to Android 9.0 (API level 28) or higher.

To achieve this, you first need to enable the mainTemplate.gradle. Refer to Enable Gradle Template. You can add the gradle properties that ensure build compatibility with android adding the following entries to you mainTemplate.gradle file:

project.ext.set('android.useAndroidX', true)
project.ext.set('android.enableJetifier', true)

For more information about AndroidX, click here.

iOS Specific Setup

Disabling Multi-Tasking Setup

iOS 9 added multitasking support. However, this interferes with an ad's ability to set the orientation of the app.

For ads to show properly, you must disable this feature.

You can do this from the Player Settings by checking the box labeled Requires Fullscreen.

Enabling Modules in Xcode Project

  1. In the Xcode project, go to the project settings and select the Build Settings tab.
  2. Under TARGETS, select "UnityFramework".
  3. In Build Settings, search for the term "modules". Under the section "Apple Clang - Language - Modules", set the "Enable Modules (C and Objective-C)" to "Yes"

Adding 3rd Party SDKs

For details instruction on how to integrated our mediated partners, check Supported Networks and their SDKs page here.

Updated 11 days ago

Unity SDK Integration


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.