.NET MAUI Mobile Application Implementation Guide¶
Abstract
In this section we will walk through how you can implement and verify WOGAA tracking for your mobile application on iOS and Android.
Warning
Do not reshare this document with anyone unless they need to implement WOGAA tracking on their mobile applications.
Latest Version¶
The latest version of WOGAA MAUI Mobile Trackers is 6.1.0
.
Dependencies¶
- Visual Studio
- LiteDB 5.0.16
- Snowplow Tracker 1.2.1
- Snowplow Tracker PlatformExtensions 1.2.1
- Android SDK API 16 and above
- Target Framework 9.0
Info
DotNet MAUI Tracker uses Snowplow DotNet Trackers.
Step 1. Install dependencies¶
Install LiteDB¶
- Open Manage NuGet Packages
- Search for
LiteDB
- Select
LiteDB
with version5.0.16
- Click Add Package
Install Snowplow Tracker¶
- Open Manage NuGet Packages
- Search for
Snowplow Tracker
- Select
Snowplow Tracker
- Click Add Package
Install Snowplow Tracker PlatformExtensions¶
- Open Manage NuGet Packages
- Search for
Snowplow Tracker PlatformExtensions
- Select
Snowplow.Tracker.PlatformExtensions
- Click Add Package
Step 2. Implement codes for .NET MAUI tracking¶
Wogaa Tracker¶
- Copy WogaaTracker.cs to the main project directory.
- Update the namespace in
WogaaTracker.cs
-MultieplatformApp
to your project namespace. - Add the following code into the
App.cs
protected override void OnStart()
{
if (Tracker.Instance.Started)
{
Tracker.Instance.SetBackground(false);
}
}
protected override void OnSleep()
{
if (Tracker.Instance.Started)
{
Tracker.Instance.SetBackground(true);
}
}
protected override void OnResume()
{
if (Tracker.Instance.Started)
{
Tracker.Instance.SetBackground(false);
}
}
.NET MAUI¶
.NET MAUI
Add the following code into App.xaml.cs App
function after InitializeComponent()
if (!Snowplow.Tracker.Tracker.Instance.Started)
{
WogaaTracker.Init(
url: WogaaTracker.ENVIRONMENT.staging,
appId: "com.xxxx.xxx"
);
}
Add following code to all ContentPage
into Constructor
function, and replace the Screen Name
to your actual screen name.
WogaaTracker.TrackScreenView("Screen Name");
iOS¶
Add the following code into AppDelegate.cs WillTerminate
function
WogaaTracker.Shutdown();
Android¶
Add the following code into MainApplication.cs OnTerminate
function
WogaaTracker.Shutdown();
Step 4. Check MAUI implementation¶
Method 1: Manually check the logs¶
Run your application using Xcode or Android Studio and verify the platform logs below
iOS¶
WOGAATracker Started: 6.1.0
Info: Emitter flushed all (1) events successfully
Note
Info: Emitter flushed all (1) events successfully
shows number of successful event(s) being sent to our backend system
Android¶
WOGAATracker Started: 6.1.0
Info: Emitter sent and deleted 1 events
Note
Info: Emitter sent and deleted 1 events
shows number of successful event(s) being sent to our backend system
Method 2: Use tool to check if data is being received in your environment(s).¶
Info
- Staging received events will take about 10 seconds to process. (Last 24 hours)
- Production received events will take about 1 day to process.
Step 4. Verification of MAUI Implementation¶
Move to Production¶
Change the Environment variable from Staging
to Production
.
WogaaTracker.ENVIRONMENT.Production
A verification email will be sent once we have successfully received data from your mobile application in production server.
It may take up to 7 working days for the verification. Please let us know if there is any issues with regards to this via support@wogaa.gov.sg