I am trying to create some functionality when a users links into the app. I have created the apple-app-site-association file on the server. It is correctly recognized as an app link and opens my app. The issue is the OnAppLinkRequestReceived event doesn't seem to get triggered.
In my App.xaml.cs:
public App()
{
InitializeComponent();
MainPage = new AppShell();
#if IOS
(Application.Current as IApplicationController)?.SetAppIndexingProvider(new Microsoft.Maui.Controls.Compatibility.Platform.iOS.IOSAppIndexingProvider());
#endif
try
{
var entry = new AppLinkEntry
{
Title = "Find Shop",
Description = "Find Shop Deep Link",
AppLinkUri = new Uri(GlobalVariables.FindShopDeepLink, UriKind.RelativeOrAbsolute),
IsLinkActive = true
};
entry.KeyValues.Add("contentType", "id");
entry.KeyValues.Add("appName", "PopUp Shop");
entry.KeyValues.Add("companyName", "Cefworx, LLC");
Application.Current.AppLinks.RegisterLink(entry);
}
catch (Exception ex)
{
Crashes.TrackError(ex);
Crashes.TrackError(new Exception("Deeplink failed."));
}
}
protected async override void OnAppLinkRequestReceived(Uri uri)
{
await Current.MainPage.DisplayAlert("AppLink", "You are linking!", "OK");
}
In my Maui.Program:
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiCompatibility()
.UseMauiApp<App>(
.UseMauiCommunityToolkit();
.....
}