Go to file
Kevin Boos 0c8e0dad65 Use `LaunchUriAsync` on windows.
This works more reliably than issuing a `start <URI>` command.
2024-05-29 16:33:05 -07:00
examples Use new robius-android-env API. Add optional log feature. 2024-05-06 15:51:05 +10:00
src Use `LaunchUriAsync` on windows. 2024-05-29 16:33:05 -07:00
.gitignore Cleanup 2024-04-13 06:47:16 +10:00
Cargo.lock Use `LaunchUriAsync` on windows. 2024-05-29 16:33:05 -07:00
Cargo.toml Use `LaunchUriAsync` on windows. 2024-05-29 16:33:05 -07:00
README.md Fix README links 2024-05-22 16:07:05 -07:00

README.md

robius-open

Latest Version Docs Project Robius Matrix Chat

This crate provides easy Rust interfaces to open URIs across multiple platforms, including:

  • macOS (via NSWorkspace)
  • Android (via android/content/Intent)
  • Linux (via xdg-open)
  • Windows (via start)
  • iOS (via UIApplication)

URIs take many different forms: URLs (http://), tel:, mailto:, file://, and more (see the official list of schemes).

Examples

use robius_open::Uri;
Uri::new("tel:+61 123 456 789")
   .open()
   .expect("failed to open telephone URI");
use robius_open::Uri;
Uri::new("http://www.google.com")
   .open()
   .expect("failed to open URL");

Android usage

To use this crate on Android, you must add the following to your app manifest:

<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
   tools:ignore="QueryAllPackagesPermission" />

<queries>
   <intent>
      <action android:name="android.intent.action.MAIN" />
   </intent>
</queries>

or alternatively, disable the android-result feature.

However, disabling this feature will make Uri::open() always return Ok, regardless of whether the URI was successfully opened.