Skip to content

Commit

Permalink
add android support
Browse files Browse the repository at this point in the history
  • Loading branch information
yazgoo authored and amodm committed Apr 2, 2020
1 parent a192f51 commit 75fad4d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,13 @@ fn open_browser_internal(browser: Browser, url: &str) -> Result<ExitStatus> {
}
}

/// Deal with opening of browsers on Android
#[cfg(target_os = "android")]
#[inline]
fn open_browser_internal(browser: Browser, url: &str) -> Result<ExitStatus> {
Command::new("am").arg("start").arg("--user").arg("0").arg("-a").arg("android.intent.action.VIEW").arg("-d").arg(url).status()
}

/// Deal with opening of browsers on Mac OS X, using `open` command
#[cfg(target_os = "macos")]
#[inline]
Expand Down Expand Up @@ -343,6 +350,7 @@ fn open_on_unix_using_browser_env(url: &str) -> Result<ExitStatus> {
}

#[cfg(not(any(
target_os = "android",
target_os = "windows",
target_os = "macos",
target_os = "linux",
Expand Down

0 comments on commit 75fad4d

Please sign in to comment.