Access Process

Login MG advertising platform websiteto register a developer account.fter the registration , create an application, add advertising space information (advertising space ID will be generated after adding , which will be used later when embedding advertising), and then generate an official channel Publisher ID (embed in advertising later) , and then download advertising SDK compressed file, which includes SDK file and development documentation, you can embed the advertising in your app according to the documentation. After embed successfuly , the app can be updated to Microsoft developer background for review. After the review , you can promote the app to get advertising revenue.

Register MG Developer Account

Login MG Advertising Platform website to register a developer account.

Create an App

Login developer background and select the function menu "Application Management --> Application List", click the "Add" button in the upper right corner to create app.

Note::

"*" is required

The "application name" needs to be noted. You need to fill in the application name in English . If it is a Chinese product, you can use the acronym of the product.

"Application Status" Select "Unreleased" status for the first time.

Create Advertising Space

Login developer background and select the function menu "Advertising platform --> Ad space list". Click "Add" button in the upper right corner to create Ad space. After the addition, an "Ad Space Primary Key" will be generated for each Ad space. "Ad Space Primary Key" is used to access Ad space in-game.

Note:

"*" is required

Ad Space size can be customized, Ad Space extracts the same size Ad materials from background Ad library.

In Ad type, full screen is unavailable temporarily , only the last 6 types are selected for creation.

Refresh time: The time interval for refreshing ad.

Developers need to register seven ad space at the same time, thay are two screens, one insert screen, two banners, each pair corresponding to pc and mobile phone, one exit screen ad sapce .Use “Usage Status” option in the figure to control the advertisement display.Coopen size is recommended 1366*768, 1920*1080, insert screen size is recommended 320*320, 640*640, 300*250, banner 350*50, 480*80, and exiting screen 300*50.

Access to Ad Sapce

Please click to download Ad SDK

SDK needs to be initialized SDK before accessing to Ad sapce.

The game can access four ad space, they are coopen , banner, insert screen, and exiting screen.

Coopen , banner, insert screen

After creating coopen , banner, insert screen ad space in MG background, insert the following code in the relevant location of the game code

try
{
	//This code is to ensure that the ad is added on the main thread, if it is a direct call, you do not need to add this sentence.
	//But if you ask the server to return data and then add an ad, you need to add this code, because the request server data is called to another thread to operate, the UI belongs to the main thread
	Windows.ApplicationModel.Core.CoreApplication.MainView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () =>
	{
		MiracleGames.Advertising.UI.AdControl ad = new MiracleGames.Advertising.UI.AdControl("xxxxxxxxxx",”yyyyyyyyyy” true);
		grid.Children.Add(ad);
	});
}
catch(Exception ex)
{
	string value = ex.ToString();
}

Coopen

Generally,Coopen advertising space is implemented in the load of MainPage .

Exiting Screen

Initialize exiting advertising space in Loaded method of mainpage.xaml.cs

if (MiracleGames.ApplicationManager.SetupCompletedSuccessfully)
{
    try
    {
        var mgAD = new AdControl("1B4FF5F216", "1B4FF5F216", true);
        mgAD.CloseIconVisibility = Visibility.Visible;
        Grid.SetRowSpan(mgAD, 10);
        RootGrid.Children.Add(mgAD);
    }
    catch (Exception)
    { }
}

Register for background events in app.xaml.cs, add the following code in the background event

bool exit = false;       
private async void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
{
    exit = false;
    var deferral = e.GetDeferral();
    await System.Threading.Tasks.Task.Delay(5000);
    exit = true;
    deferral.Complete();
}

Add the following code to Suspending event in app.xaml.cs

private void OnSuspending(object sender, SuspendingEventArgs e)
{
    if(!exit)
    {
        MiracleGames.Advertising.AdvertisingManager.ExitAd();
    }
    var deferral = e.SuspendingOperation.GetDeferral();
    deferral.Complete();
}

WMS message push

Register OnActivated events in app.xmal. Cs

protected override void OnActivated(IActivatedEventArgs args)
{
    MiracleGames.Advertising.AdvertisingManager.ToastAd(args);
    base.OnActivated(args);
}



Video Guide