Skip to main content

SDK Initialization

Introduction

Before integrating the MG Ads SDK, it is necessary to first perform SDK initialization and CMP calls. Only after initialization is completed can the full functionality of this SDK be used in coordination with the backend system. The SDK initialization should be performed immediately upon entering the game.

SDK Initialization

[Header("Configuration Parameters")]
public string appKey = "your_app_key";
public string secretKey = "your_secret_key";

void Start()
{
//CMP
UnityApplicationManager._instance.OpenCmp();
//Initialization
UnityApplicationManager._instance.Initialize(appKey, secretKey);
}

Possible Errors if Initialization Fails

● Network failure, no proper network support

  ● UWP applications do not support VPN, and VPN software is enabled on the local machine.

  ● Incorrect AppId, please log in to the developer backend to check application settings.

  ● Server issues, please check the error information in the result and contact technical support promptly.