Skip to main content

Initialize the .NET MAUI SDK

Integrate the Rokt .NET MAUI SDK

The Rokt .NET MAUI SDK requires a minimum .NET version of 8.
Its target frameworks are net8.0-android and net8.0-ios.

To add the Rokt .NET MAUI SDK to your project, go to the root of your project and run:

$ dotnet add package Rokt.Maui.Sdk

Initialize the Rokt .NET MAUI SDK

caution

Contact Rokt for the Rokt Account ID associated with your account. In order to test your integration, you can use the test account ID below. Remember, however, that this needs to be replaced by your unique Rokt Account ID before launching.

Test Rokt Account ID: 222

We recommend calling Initialize at the start of your application:

    // 1) Replace the integration test tag ID (222) with your unique Rokt Tag ID
// 2) Replace 1.0.0 with the application version
Rokt.Maui.Sdk.Rokt.Initialize("2754655826098840951", "1.2.3");

If your app targets frameworks other than iOS and Android make sure to utilize methods such as Conditional compilation to only call the Rokt SDK for iOS and Android platforms.

Receiving initialization status

The Rokt .NET MAUI SDK broadcasts initialization status through its RoktEvents() async stream.

await foreach(var roktEvent in Rokt.Maui.Sdk.Rokt.RoktEvents())
{
if (roktEvent is RoktEvent.InitComplete initEvent)
{
Console.Out.WriteLine(initEvent.Status);
}
}

Next steps

Your next steps depend on the use case of your integration. Check out these resources for more information:

Was this article helpful?