⌨️SDK integration

Requisites

This documentation has been written for Unity 2020 or higher. It is recommended to use these versions when integrating the SDK.

Import Unity package

In first place, it is needed to download the Unity package from the following link: https://cdn.resources.wortise.com/sdk/unity/Wortise-Unity-1.5.0.unitypackage

Once downloaded, double click on the file to import it into the project.

Setup project

Once the package has been imported, the project needs to be properly configured.

Open the Player settings (Edit > Project Settings > Player), select the tab with the Android icon, expand the Publishing Settings panel and check the Custom Main Gradle Template and Custom Gradle Settings Template options.

After following this step, open the settingsTemplate.gradle file located at Assets/Plugins/Android and add the following Maven repositories inside the repositories block located at dependencyResolutionManagement.

repositories {
    maven { url 'https://maven.wortise.com/artifactory/public' }

    maven { url 'https://android-sdk.is.com/' }
    maven { url 'https://artifact.bytedance.com/repository/pangle' }
    maven { url 'https://cboost.jfrog.io/artifactory/chartboost-ads/' }
    maven { url 'https://maven.ogury.co' }
}

Finally, on the mainTemplate.gradle file, add the following line inside the dependencies block:

implementation 'com.wortise:android-sdk:1.6.1'

Setup Manifest

To improve the eCPM of Google's Open Bidding partners, it is needed to add a <meta-data> element in the AndroidManifest.xml file, inside the <application> block.

This value can be found in our dashboard, inside the app details, under the name Google App ID.

<manifest>
    ...
    <application>
        ...
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
    </application>
</manifest>

It is very recommended to request the user consent to be able to show personalised ads. This will allow to display content of more interest and generate higher revenues.

You can consult the following section to implement this request and obtain the user consent: User consent

Initialize SDK

To initialize the SDK, it is needed to add the following lines in the Start() method of the first project Scene. Also, we recommend to implement the OnInitialized event to request the consent once the initialization has finished:

void Start() {
    ...
    
    WortiseSdk.OnInitialized += () => {
        WortiseConsentManager.RequestIfRequired();
    };
    
    WortiseSdk.Initialize("your app key");
}

Test mode

To verify the integration, the SDK provides a test mode that allows the app to always receive ads.

Beside the option that is available in our dashboard, you can programatically enable this test mode, from the SDK itself, by using the following code:

WortiseAdSettings.IsTestEnabled = true;

Última actualización