Min required to handle deep links in Xamarin Forms

MagendanzMagendanz USMember ✭✭

James Montemagno has some great blogs online to help Xamarin Forms developers with application indexing and deep linking, but what if we only need to handle deep links? What’s the bare minimum necessary?

It seems that I don’t need the Xamarin.Forms.AppLinks NuGet package or to register the application or website in Google's Developer Console. There’s also no need to create and register AppLinkEntry instances or place a Assets.json file. I just need to configure the intent filter.

My problem, however, is that all of the examples show the intent filter applied to the MainActivity. Because of that, each time a deep link is clicked it creates a new instance of the Forms app because of the LoadApplication(new App()) call. There’s a hefty performance hit for that, and in my case it kicks off a bunch of initialization and login stuff that really doesn’t need to be run more than once.

I noticed that apps like Facebook and LinkedIn have created a separate activities to handle the intent filters for deep links, but when I try that I find that my OnAppLinkRequestReceived() method is never called.

All I’m really looking for here is to handle a deep link with minimum code and without spawning additional instances of the Forms app. Could anyone point me to an example on how to do that without all the indexing baggage?

Posts

  • AlexVilensAlexVilens USUniversity ✭✭

    My OnAppLinkRequestReceived() method is not being invoked either

  • MagendanzMagendanz USMember ✭✭

    So, the problem with spawning additional instances of the Forms app seems to be solved by setting LaunchMode = LaunchMode.SingleTask on the MainActivity.

  • AlexVilensAlexVilens USUniversity ✭✭

    I've just tried that, but OnAppLinkRequestReceived() didn't get control still

Sign In or Register to comment.