SDK Initialization

Introduction

Before accessing Miracle Games SDK, need to initialize SDK first. After the initialization, you can use all functions of SDK with background system. In general, SDK initialization is performed after entering game.

SDK Initialization

Open App.xaml.cs file and add the following method code to the class.

UWPCPP

Public Mainpage()
{
    This.InitializeComponent();
    Load + =(sender,args)=>
    {      
          var result = await MiracleGames.ApplicationManager.SetupAsync("YOUR_APP_KEY");
         if (!result.ReturnValue)
             return;
   };
}

MainPage :: MainPage()
{
    InitializeComponent();    
      
    Loaded += ref new RoutedEventHandler([this](Object^, RoutedEventArgs^)
    {
        //replace your own "YOUR_APP_KEY" here
concurrency::create_task(MiracleGames::ApplicationManager::SetupAsync(L"YOUR_APP_KEY")).then([this](MiracleGames::Services::Core::Common::AsyncProcessResult^ result)
        {
            if (!result->ReturnValue)
                return;               
          
        });
    });
}


Or declare the initialization method in the mainPage () method in MainPage.xaml.cpp


   if (!MiracleGames::ApplicationManager::SetupCompletedSuccessfully)
	{    
        //replace your own "YOUR_APP_KEY" here
		auto initTask = Concurrency::create_task(MiracleGames::ApplicationManager::SetupAsync(AppKey));
		initTask.then([](MiracleGames::Services::Core::Common::AsyncProcessResult^ result)
		{	
		if (!result->ReturnValue)
           	  return;             
		});
	}

	

MG Message push

In the old version the message push had to be pushed manually, but in the new version it has been automatically merged so no calls are needed.

Errors that initialize failed may be as follows