Deep linking opens the app but doesn't open the link xamarin forms

mouhib bahri 96 Reputation points
2021-09-02T14:32:52.55+00:00

When I tap on the link, the app opens but navigates to MainPage instead of reading the url and opening the corresponding page. I tried to click on the link again ,when the app is already opened, and it worked! It seemed like the constructor

public App(){ InitializeComponent(); MainPage = new NavigationPage(new MainPage ()); }

works first when the app is opened instead of

protected override async void OnAppLinkRequestReceived(Uri uri)
{
    base.OnAppLinkRequestReceived(uri);
    MainPage = new NavigationPage(new Page1(""));
}

How do I set the priority for OnAppLinkRequestReceived() before App()?

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,294 questions
{count} votes

Accepted answer
  1. mouhib bahri 96 Reputation points
    2021-09-03T14:04:18.887+00:00

    I think the problem was that in 'OnAppLinkRequestReceived ' I had a load of tasks to do like reading the data and connecting with the database so probably the app just navigates to the mainpage which is strange to be honest... I tried to do less work in that event in App.xaml.cs and just pass the link through parameters to the corresponding page and letting it do the tasks instead.

    0 comments No comments

0 additional answers

Sort by: Most helpful