Skip to content

AppAmbit: Getting Started with MAUI

This guide walks you through setting up the AppAmbit .NET SDK in your application, focusing on AppAmbit Analytics and Crash Reporting.

1. Prerequisites

Before getting started, ensure you meet the following requirements:

  • Your project is configured in Visual Studio or Visual Studio for Mac.
  • The target devices run iOS 11.0 or higher, or Android 5.0 (API level 21) or higher.
  • You are not using another SDK for crash reporting.

Supported Platforms

  • MAUI for iOS
  • MAUI for Android
  • MAUI for Windows (coming soon)
  • MAUI for macOS (coming soon)
Note: Xamarin is currently not supported by the AppAmbit library.

Platform-Specific Instructions

Android

Register a new app on the AppAmbit portal and select Android as the target OS.

iOS

Register a new app on the AppAmbit portal and select iOS as the target OS.

macOS (coming soon)

Register a new app on the AppAmbit portal with macOS as the target OS.

MAUI (iOS, macOS (coming soon), Android, and Windows Desktop (coming soon))

Create separate applications in the AppAmbit portal—one for each OS.

2. Creating Your App in the AppAmbit Portal

  1. Visit AppAmbit.com.
  2. Sign in or create an account. Navigate to "Apps" and click on "New App".
  3. Provide a name for your app. Optionally, upload an image via drag-and-drop.
  4. Select the appropriate release type and target OS.
  5. Click "Create" to generate your app.
  6. Retrieve the App Key from the app details page.
  7. Use this App Key as a parameter when calling .UseAppAmbit("<YOUR-APPKEY>") in your project.

Adding the AppAmbit SDK to Your Solution

NuGet

Add the package to your MAUI project:

dotnet add package com.AppAmbit.Sdk
# or specify version
dotnet add package com.AppAmbit.Sdk --version 0.0.3

Or, using Visual Studio:

  • Right-click your project → Manage NuGet Packages…
  • Search for AppAmbit and install the latest stable version.

Initializing the SDK

To begin using AppAmbit, you need to explicitly enable the services you wish to use. No services are activated by default.

Import the Namespace

Add the required using directive to your file:

using AppAmbit;

Using .UseAppAmbit()

Call .UseAppAmbit("<YOUR-APPKEY>") during application initialization:

.UseAppAmbit("<YOUR-APPKEY>");

Here's an example of how to configure it within your MauiProgram class:

using AppAmbit;

public static class MauiProgram
{
    public static MauiApp CreateMauiApp()
    {
        var builder = MauiApp.CreateBuilder();
        builder
            .UseMauiApp<App>()
            .UseAppAmbit("<YOUR-APPKEY>");

        return builder.Build();
    }
}

This code automatically generates a session, the session management is automatic.

Android Requirements

Add the following permissions in your AndroidManifest.xml:

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />

iOS and macOS (coming soon) Requirements

For iOS, add the required URL exceptions in your Info.plist file:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>appambit.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
    </dict>
</dict>