4
votes

I'm trying to implement deep linking ability using xamarin + mvvmcross,

the deep-linking configuration in either plist/manifest are already done and working.

What i'm trying achieve is that when either my app is running or not, i would like my main view model to handle the params sent by the deep-link in it's InitFromBundle (IMvxBundle bundle) method (my Main view model is always alive while the app is running).

While in android it's fairly easy to achieve by overriding the TriggerFirstNavigate in the splash screen activity and overriding the IMvxAppStart Start method, i'v gone through the mvvmcross source to see how it's done in Xamarin.iOS and still no luck.

When my ios app is opened from a deep-link, the InitFromBundle (IMvxBundle bundle) method do handle the url params, but when i click on deep-link while my app is alive, it bring the app to the front but doesnt call the InitFromBundle method.

What i did already is check in the apple developers about how it works, as can be seen here:

My case can be seen in Figure 6-2 in the above link.

1

1 Answers

3
votes

This is just a guess, but based on the docs I would imagine you need to override HandleOpenURL inside the appdelegate.cs. You might then want to use a messenger to alert your application that a new url has been requested, or follow the answer here to navigate to a view model from a view.

e.g.

public override bool HandleOpenURL (UIApplication application, NSUrl url)
{
    if (url != null)
    {
        //do navigation or message notification here
        return true;
    }
    else
        return false;
}