How To Implement Biometric Unlock in MAUI
Use the Microsoft.Maui.ApplicationModel APIs with platform-native biometric services.
1. Add Microsoft.Maui.Essentials
(already included in MAUI projects)
2. Check if biometrics are available
3. Run on App Launch or Protected Page
Platform Notes
Android:
-
Uses BiometricPrompt API (supports face, fingerprint, iris)
iOS:
-
Uses Face ID or Touch ID, depending on hardware
Windows:
-
Uses Windows Hello (face, fingerprint, PIN)
What It Does
-
Prompts user for biometric authentication on app start
-
Grants access if biometric is successful
-
Exits or denies access if authentication fails
Step-by-Step Setup
✅ 1. Create a new MAUI App
✅ 2. Install Required Package (optional for Android)
.NET MAUI
includes most features out of the box. No extra packages are required for biometrics viaMicrosoft.Maui.ApplicationModel
.
✅ 3. MainPage.xaml
✅ 4. MainPage.xaml.cs
Platform-Specific Configuration
✅ Android: AndroidManifest.xml
Add these inside <manifest>
:
✅ iOS: Info.plist
Add these inside <dict>
:
✅ Windows: No config needed
Uses Windows Hello automatically.
✅ Run and Test
-
Android: Face unlock, fingerprint, or device credential (depending on device)
-
iOS: Face ID or Touch ID
-
Windows: Windows Hello (if available)
No comments:
Post a Comment