This library offers camera preview and barcode scanning functionality for .NET MAUI apps using native platform APIs with Google ML Kit and Apple VisionKit.
This library is available on NuGet: https://www.nuget.org/packages/AppLinks.MAUI Use the following command to install AppLinks.MAUI using NuGet package manager console:
PM> Install-Package AppLinks.MAUI
You can use this library in any .NET MAUI project compatible to .NET 8 and higher.
- Register app link host in
MainActivity
by creating one or moreIntentFilter
withDataScheme
andDataHost
. - Create
assetlinks.json
file which contains Android package name(s) and sha256_fingerprints used to sign the package. - Deploy
assetlinks.json
file to root web folder.well-known
. - Verify the app links for each package name:
adb shell pm verify-app-links --re-verify {package_name}
- Check if verification was successful:
adb shell pm get-app-links {package_name}
- Login to https://developer.apple.com, go to "Certificates, Identifiers & Profiles", select tab "Identifiers".
- Select the app identifier which should support app links.
- Enable the option "Associated Domains" and save the changes.
- Update and download all dependent provisioning profiles.
- Create
Entitlements.plist
file under Platforms/iOS and add associated domains (plist key: com.apple.developer.associated-domains). - Create
apple-app-site-associate
file which contains app identifiers and target URL paths. - Deploy
apple-app-site-associate
file to root web folder.well-known
.
- This plugin provides an extension method for MauiAppBuilder
UseAppLinks
which ensure proper startup and initialization. Call this method within yourMauiProgram
just as demonstrated in the AppLinksDemoApp:var builder = MauiApp.CreateBuilder() .UseMauiApp<App>() .UseAppLinks();
Inject IAppLinkHandler
or use the static singleton instance IAppLinkHandler.Current
in your code to get access to the main features of this library.
IAppLinkHandler.AppLinkReceived
: This event is fired as soon as an app link URL is received.IAppLinkHandler.ResetCache()
: Clear any cached app link data. This clears the internal queue which is used to temporarily cache received app links.
Note
If an app link is received before the AppLinkReceived
event is subscribed, the received app link URL is cached for deferred delivery.
Warning
App links offer a potential attack vector into your app, so ensure you validate all URI parameters and discard any malformed URIs.
Contributors welcome! If you find a bug or you want to propose a new feature, feel free to do so by opening a new issue on github.com.
- https://developer.apple.com
- https://developer.apple.com/documentation/xcode/supporting-associated-domains
- https://developer.android.com/training/app-links
- https://developers.google.com/digital-asset-links/tools/generator
- https://chris.orr.me.uk/article/android-app-linking-how-it-works/
- https://learn.microsoft.com/en-us/dotnet/maui/android/app-links
- https://learn.microsoft.com/en-us/dotnet/maui/macios/universal-links
- https://branch.io/resources/aasa-validator