Launching an App for a URI

The following code shows how to launch the default Web browser using Launcher’s LaunchUriAsync method:

async Task LaunchOtherApp() {   // Launch the default Web browser   bool success = await Launcher.LaunchUriAsync(new Uri("http://pixelwinks.com"));   if (!success)   {     ...   } }

When you launch an app for a URI, the file type no longer matters. For example, if you call LaunchUriAsync with http://blog.adamnathan.net/images/logo.png, it still launches the default Web browser rather than the default image viewer because the URI scheme is http. If the URI starts with mailto:, then the default mail program is used.

Custom URI schemes are supported as well as the standard ones. The Maps ...

Get Universal Windows® Apps with XAML and C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.