Xamarin Forms, Autodesk Forge and Android DeepLinking

Finally, after covering UWP and iOS we are going to take a quick look at Android. Android seemed to be the easiest to get setup for me. All I had to do was to make the declaration of the deep linking to an IntentFilter attribute on the MainActivity class. When you add the IntentFilter, Xamarin will automatically update the manifest file for you.

In the code below, the most important items are the DataScheme and DataHost attributes. They are the ones that tell Android that the declared protocol is handled by the application.

[Activity(Label = "DeepLink",
    Icon = "@drawable/icon",
    Theme = "@style/MainTheme",
    MainLauncher = true,
    ConfigurationChanges = ConfigChanges.ScreenSize |
        Android.Content.Intent.ActionView },
        AutoVerify = true,
        Categories = new[]
    DataScheme = "bbsw-fm",
    DataHost = "brainbucketsoftware.com")]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    protected override void OnCreate(Bundle bundle)
        TabLayoutResource = Resource.Layout.Tabbar;
        ToolbarResource = Resource.Layout.Toolbar;


        /// ... rest of the OnCreate

Unlike iOS and UWP, Xamarin Forms routes the event back to the portable Application class and the OnAppLinkRequestReceived function. From there you can process the access token:

protected override async void OnAppLinkRequestReceived(Uri uri)
    bool retrievedToken = await AuthWorkflowService.GetAccessTokenAsync(uri.ToString());
    if (retrievedToken)
        await NavigationService.NavigateAsync(Pages.Test);

In the next post, we will look at processing the response to get the access token.