Get started with .NET MAUI
Build a small app that enrols your face and verifies it offline, on your own phone.
A face check that works in airplane mode
An app that enrols your face, verifies it live with a head-turn liveness check, and still matches with no network.
1
Get a sandbox key#
Sign up at app.faceping.ai/signup with your email, then open Developers → Sandbox keys → Create sandbox key. It starts with fp_test_.
The sandbox is free and instant: up to 25 faces per device, each deleted 24 hours after it was enrolled. No card, no approval.
2
Create the project#
You need the .NET 10 SDK with the MAUI workload, and an Android phone (Android 7 or later) or an iPhone with a cable.
dotnet workload install maui
dotnet new maui -n FaceCheck
cd FaceCheck
3
Add FacePing#
One package. It brings the face models, liveness checks and a camera view with it.
dotnet add package FacePing.Sdk.Maui
4
Allow the camera#
Both platforms ask the user before the camera turns on. Add the line for each platform you'll run on.
<!-- Platforms/Android/AndroidManifest.xml, inside <manifest> -->
<uses-permission android:name="android.permission.CAMERA" />
<!-- Platforms/iOS/Info.plist, inside <dict> -->
<key>NSCameraUsageDescription</key>
<string>FaceCheck uses the camera to verify your face.</string>
5
Turn FacePing on#
Register FacePing with your sandbox key, and register the page so it can be given IFacePing.
// MauiProgram.cs
using FacePing.Sdk.Maui;
builder
.UseMauiApp<App>()
.UseFacePing(o => o.SandboxKey = "fp_test_…");
builder.Services.AddTransient<MainPage>();
6
Add the screen#
A camera view and two buttons: one enrols your face on the phone, the other verifies it.
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:fp="clr-namespace:FacePing.Sdk.Maui;assembly=FacePing.Sdk.Maui"
x:Class="FaceCheck.MainPage">
<VerticalStackLayout Padding="24" Spacing="16">
<fp:FaceCameraView x:Name="Camera" HeightRequest="420" />
<Button Text="Enrol my face" Clicked="OnEnrol" />
<Button Text="Verify" Clicked="OnVerify" />
<Label x:Name="Status" FontSize="18" HorizontalOptions="Center" />
</VerticalStackLayout>
</ContentPage>
using FacePing.Sdk.Maui;
namespace FaceCheck;
public partial class MainPage : ContentPage
{
readonly IFacePing faceping;
public MainPage(IFacePing faceping)
{
InitializeComponent();
this.faceping = faceping;
}
async void OnEnrol(object sender, EventArgs e)
{
var photo = await Camera.CaptureAsync();
var result = await faceping.EnrolAsync("me", photo);
Status.Text = result.Outcome == EnrolOutcome.Enrolled
? "Enrolled. Now tap Verify."
: $"Try again: {result.Outcome}";
}
async void OnVerify(object sender, EventArgs e)
{
// A live check: matches your face, then asks you to turn your head (liveness).
var result = await faceping.VerifyLiveAsync("me", Camera);
Status.Text = $"{result.Outcome} · {result.Elapsed.TotalSeconds:0.00} s";
}
}
7
Run it on your phone#
Plug your phone in and run a Release build (Debug builds are much slower at face checks). Tap Enrol my face, then Verify: you should see Match.
dotnet build -t:Run -f net10.0-android -c Release
# Run on a connected iPhone from Visual Studio or Rider (simulators have no front camera),
# or from the command line with your device's name:
dotnet build -t:Run -f net10.0-ios -c Release -p:_DeviceName=<your iPhone>
Now switch on airplane mode and tap Verify again. Still a match: the check ran entirely on your phone.
You've built a face check that works offline#
Next, make it real: verify the people in your app (members, staff, ticket holders), and apply to go live when you're ready.