Skip to content

Instantly share code, notes, and snippets.

@rdelrosario
Created January 8, 2019 02:58
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rdelrosario/93c406946918fc2c4bc99504221ea5dd to your computer and use it in GitHub Desktop.
Save rdelrosario/93c406946918fc2c4bc99504221ea5dd to your computer and use it in GitHub Desktop.
using System;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
namespace AppLinksSample
{
public partial class App : Application
{
public App()
{
InitializeComponent();
MainPage = new MainPage();
}
protected override void OnAppLinkRequestReceived(Uri uri)
{
if (uri.Host.EndsWith("xamboy.com", StringComparison.OrdinalIgnoreCase))
{
if (uri.Segments != null && uri.Segments.Length == 3)
{
var action = uri.Segments[1].Replace("/", "");
var msg = uri.Segments[2];
switch (action)
{
case "hello":
if(!string.IsNullOrEmpty(msg)){
Device.BeginInvokeOnMainThread(async() =>
{
await Current.MainPage.DisplayAlert("hello", msg.Replace("&", " "), "ok");
});
}
break;
default:
Xamarin.Forms.Device.OpenUri(uri);
break;
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment