.NET MAUI

NuGet

.NET MAUI HyperTrack SDK allows you to integrate HyperTrack into your cross-platform .NET MAUI apps.

Requirements

Basic integration

Updating the SDK? Check out our CHANGELOG and Migration Guide to see what's changed.

Add HyperTrack SDK to your project

Add these lines to your applications .csproj:

<ItemGroup>
    <PackageReference Include="HyperTrack.SDK.MAUI" Version="VERSION" />
    
    <!-- Workaround for MAUI bug that causes Android libraries that povide .jar to not be packed into the package -->
    <AndroidMavenLibrary Include="com.hypertrack:sdk-android-model" Version="7.11.4" Repository="https://s3-us-west-2.amazonaws.com/m2.hypertrack.com/" Bind="false" Condition="'$(TargetFramework)' == 'net9.0-android'" />
    <AndroidMavenLibrary Include="org.jetbrains.kotlinx:kotlinx-serialization-json-jvm" Version="1.3.3" Bind="false" Condition="'$(TargetFramework)' == 'net9.0-android'" />
    <AndroidIgnoredJavaDependency Include="org.jetbrains.kotlin:kotlin-stdlib:1.6.21" />
    <AndroidIgnoredJavaDependency Include="org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21" />
    <AndroidIgnoredJavaDependency Include="org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21" />
    <AndroidIgnoredJavaDependency Include="org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.3.3" />
</ItemGroup>

The latest version: NuGet

Set up silent push notifications

Set the publishable key

Get your publishable key from the Setup page.

Set Worker Handle

To link a Worker with the device you should set the worker handle:

HyperTrack.SetWorkerHandle("user_id"); // unique user identifier

See Worker device linking guide for more information.

Grant the permissions to the app

Start tracking

Now the app is ready to be tracked from the cloud.

Follow the Track Work tutorial to learn how to control worker tracking from your backend (use the worker handle you set above).

Dashboard

Once your app is running, go to the dashboard where you can see a list of all your devices and their live location with ongoing activity on the map.

Recommended additional steps

Identify devices

You can tag devices with names that will make it easy to distinguish them on the HyperTrack Dashboard:

HyperTrack.SetName("Device name");

You can additionally tag devices with custom metadata (and filter them in the Dashboard using metadata fields). Metadata should be representable in JSON:

HyperTrack.SetMetadata(new Dictionary<string, object>
{
    { "key", "value" }
});

Handle errors

Use the GetErrors() or SubscribeToErrors() to ensure that when the driver navigates to the screen where tracking is supposed to happen, there are no blockers that can prevent it.

You can use the subscription API to react immediately when errors come up:

HyperTrack.SubscribeToErrors(errors =>
{
    foreach (var error in errors)
    {
        switch (error)
        {
            case HyperTrackError.LocationPermissionsDenied:
                // Handle location permissions denied
                break;
            // Handle other errors
        }
    }
});

See Errors API reference for a full list of errors.

Reference

For a full SDK API reference, see HyperTrack .NET MAUI SDK Reference.

SDK integration examples

To learn more about SDK integration examples, you may visit these resources:

Support

Join our Slack community for instant responses.