Xamarin.Essentials: Launcher

The Launcher class enables an application to open a URI by the system. This is often used when deep linking into another application's custom URI schemes. If you are looking to open the browser to a website then you should refer to the Browser API.

Get started

To start using this API, read the getting started guide for Xamarin.Essentials to ensure the library is properly installed and set up in your projects.

Using Launcher

Add a reference to Xamarin.Essentials in your class:

using Xamarin.Essentials;

To use the Launcher functionality call the OpenAsync method and pass in a string or Uri to open. Optionally, the CanOpenAsync method can be used to check if the URI schema can be handled by an application on the device.

public class LauncherTest
    public async Task OpenRideShareAsync()
        var supportsUri = await Launcher.CanOpenAsync("lyft://");
        if (supportsUri)
            await Launcher.OpenAsync("lyft://ridetype?id=lyft_line");

This can be combined into a single call with TryOpenAsync, which checks if the parameter can be opened and if so open it.

public class LauncherTest
    public async Task<bool> OpenRideShareAsync()
        return await Launcher.TryOpenAsync("lyft://ridetype?id=lyft_line");

Additional Platform Setup

No additional setup.


This features enables an app to request other apps to open and view a file. Xamarin.Essentials will automatically detect the file type (MIME) and request the file to be opened.

Here is a sample of writing text to disk and requesting it be opened:

var fn = "File.txt";
var file = Path.Combine(FileSystem.CacheDirectory, fn);
File.WriteAllText(file, "Hello World");

await Launcher.OpenAsync(new OpenFileRequest
    File = new ReadOnlyFile(file)

Platform Differences

The Task returned from CanOpenAsync completes immediately.


Find more Xamarin videos on Channel 9 and YouTube.