📱Unity Bridge SDK Implementation Guide

This guide provides a comprehensive step-by-step process for integrating the Unity Bridge AdSter SDK into your Unity Android application.

App Prerequisite

  • minSdkVersion of 21 or higher

  • compileSdkVersion of 34

Android API level is set in Project Settings > Player > Android > Other Settings > Other Settings.

Go to Project Settings > Player > Android > Publishing Settings > Build and select:

  • Custom Main Manifest Template

  • Custom Main Gradle Template

  • Custom Gradle Settings Template

Configuration Steps

Setting Up Repository in Project

  • Open your Unity project and navigate to settingsTemplate.gradle file inside Assets/Plugins/Android

  • Add the following Maven repository configuration inside the dependencyResolutionManagement block

gradle

repositories {
  ...
  maven {
    url = uri("https://maven.pkg.github.com/adster-tech/orchestration-sdk-unity-bridge")
    credentials {
      username = GITHUB_USERNAME
      password = GITHUB_TOKEN
    }
  }
}

Adding Dependency

  • Open the mainTemplate.gradle file.

  • Find the dependencies block and add the following SDK dependency.

gradle

implementation 'com.adster:orchestration-sdk-unity-bridge:2.0.06'

Authentication

  • It's crucial not to hardcode GitHub credentials. Store credentials in gradle.properties or use environment variables.

  • In gradle.properties, add

    properties
    
    GITHUB_USERNAME=username
    GITHUB_TOKEN=token
  • In settings.gradle, reference these properties:

    gradle
    
    username = findProperty("GITHUB_USERNAME") ?: System.getenv("GITHUB_USERNAME")
    password = findProperty("GITHUB_TOKEN") ?: System.getenv("GITHUB_TOKEN")

Use the below link to download the file and add AdsterBridgeUtil.cs in Assets > Scriptsin your unity project.

https://storage.googleapis.com/adster-unity-bridge-docs/AdsterBridgeUtil.cs

AndroidManifest.xml

Add the below code inside the androidmanifest.xml file.

<activity android:name="com.adster.adsterunitybridge.unitybridge.CustomUnityPlayerActivity"
                  android:label="@string/app_name"
                  android:exported="true"
                  android:theme="@style/UnityThemeSelector">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
        </activity>

Last updated