FreeStar Ads Mediation for Unity Android - freestarcapital/SDK_documentation_Android GitHub Wiki

Freestar Ads Mediation - Unity Integration Guide for Android

Getting Started

Start displaying Freestar Ads in your Unity game today by following the simple steps below.

Requirements

• Unity 2018 or newer

• Minimum Android API Level: 21 or higher

Begin

Please follow the instructions in order.

Make sure you switched to Android:

Import FreestarMediation unitypackage

Unity Player Settings

Import FreestarMediation unitypackage

Other settings: Minimum API Level: 21

Other settings: Target API Level: Highest Installed

Other settings: Api Compatability Level: .NET 4.x

Import FreestarMediation unitypackage

Publisher Settings: Custom Gradle Template ✅

Do Not Install Unity Ads

If you try to use Unity Ads Package with FreestarMediation, this will produce a build-time error because FreestarMediation already contains the Unity Ads library.

Import Custom Package

Download FreestarMediation.unitypackage

Next, we will import it into Unity as a Custom Package.

Import FreestarMediation unitypackage

Assets: Import Package: Custom Package

Import FreestarMediation unitypackage

Hit the Import button.

Resolve Android Dependencies

After importing our custom package, resolve Android dependencies via Assets.. External Dependency Manager... Android Resolver... Resolve.

Import FreestarMediation unitypackage

Manually Edit mainTemplate.gradle

Use your favorite file editor.

Edit [Unity Project Folder]/Assets/Plugins/Android/mainTemplate.gradle

Remove the top line:

// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN

Import FreestarMediation unitypackage

Add the following to the android root section:

    packagingOptions {
        exclude("META-INF/*.kotlin_module")
    }

Save your changes to mainTemplate.gradle

AndroidManifest.xml

Take a look at file [Unity Project Folder]/Assets/Plugins/Android/AndroidManifest.xml

Before going to production, you will need to modify the following values. For now, you can use what's already there.

    <meta-data
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="ca-app-pub-3940256099942544~3347511713"/>

    <meta-data
        android:name="applovin.sdk.key"
        android:value="hO52kFtMvEo_AoeRzED0_XXfS1B1VQp9GW50yudJO-eUUTOmRBLl3c-2GyTevLNspll_fN5PLTbAHOakoTuHuP" />

    <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>

Ready to Build Android

At this point, you should be able to build Android. If you encounter the following dialogs, hit 'YES'.

Import FreestarMediation unitypackage

OR

Import FreestarMediation unitypackage

Freestar Initialization and Displaying Ads

Take a look at Assets/FreestarMediation/SampleFreestarAds.cs which was imported into your Unity project.

This working sample shows how to initialize, implement the ad listeners, and show banner, fullscreen Interstitial and Rewarded ads.
Assets/FreestarMediation/SampleFreestar.scene is also included.

Some publishers like to create a singleton class based on this sample. Utilize it as you see fit.

You can use the test key in SampleFreestarAds.cs

⚠️ **GitHub.com Fallback** ⚠️