Aller au contenu principal

Getting Started

info

This section explains how to getting started BlueStack MAUI Plugin. It guides you through the process of adding the BlueStack MAUI Plugin to your project. After following this section you’re being able to getting started with the more advanced features of the BlueStack MAUI Plugin.

Prerequisites

  • Use .NET 8
  • Android
    • Minimum API level 21 or higher
  • iOS

Integrate the BlueStack SDK

BlueStack MAUI support is facilitated through a collection of NuGet packages, strategically divided to uphold a more refined separation of concerns. The segmentation of plugins across multiple packages ensures a streamlined approach to maintenance. Here is the comprehensive list of these packages:

  • BlueStack.SDK.Maui - A MAUI package designed for communication between a MAUI application and the native BlueStack SDK through bridge.
  • BlueStack.SDK.Core.iOS.Binding
  • BlueStack.SDK.Bridging.iOS.Binding
    • BlueStack.SDK.Core.Android.Binding - This package encompasses the Android BlueStack Mediation SDK along with its native dependencies.
  • BlueStack.SDK.Core.Android.Bridge.Binding - Provide android native bridging support for BlueStack.SDK.Maui.

As a MAUI app developer you will only have to add BlueStack.SDK.Maui package in you app. BlueStack.SDK.Maui will automatically download the necessary dependencies transitively.

...
<ItemGroup>
<PackageReference Include="BlueStack.SDK.Maui" Version="1.1.7" />
</ItemGroup>
...

Initialize the BlueStack SDK

Before loading ads, you need to initialize the BlueStack SDK by calling BlueStackAds.Initialize(). This needs to be done only once, ideally at app launch. BlueStack initialization process initialize the BlueStack and it's configured mediation ad networks. So OnAdSDKInitialized will be called multiple times with newly initialized ad netowrk.

public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
...
Settings settings = new Settings(isDebugModeEnabled:true);
BlueStackAds.Initialize(appId, settings, OnAdSDKInitialized);
...
}

private void OnAdSDKInitialized(InitializationStatus initializationStatus)
{
foreach (KeyValuePair<string, AdapterStatus> adapterStateEntry in
initializationStatus.GetAdapterStatusMap())
{
#if ANDROID
Log.Debug("MainPage", "AdapterName: " + adapterStateEntry.Value.Name + " AdapterStatus: " +
adapterStateEntry.Value.InitializationState + " Description: " +
adapterStateEntry.Value.Description);
#endif
}
...
}
}