Skip to content

Instantly share code, notes, and snippets.

Last active Mar 26, 2019
What would you like to do?
public static partial class Launcher
public static async Task<bool> LaunchUriAsync(Uri uri)
#if __IOS__
return UIKit.UIApplication.SharedApplication.OpenUrl(new global::Foundation.NSUrl(uri.OriginalString));
#elif __ANDROID__
var androidUri = global::Android.Net.Uri.Parse(uri.OriginalString);
var intent = new global::Android.Content.Intent(global::Android.Content.Intent.ActionView, androidUri);
return true;
#elif __WASM__
var command = $"\"{uri.OriginalString}\");";
var result = Uno.Foundation.WebAssemblyRuntime.InvokeJS(command);
return result == "True";
throw new NotImplementedException();
catch (Exception exception)
if (typeof(Launcher).Log().IsEnabled(LogLevel.Error))
typeof(Launcher).Log().Error($"Failed to {nameof(LaunchUriAsync)}.", exception);
return false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment