Skip to content

Commit 75fad4d

Browse files
yazgooamodm
authored andcommitted
add android support
1 parent a192f51 commit 75fad4d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,13 @@ fn open_browser_internal(browser: Browser, url: &str) -> Result<ExitStatus> {
232232
}
233233
}
234234

235+
/// Deal with opening of browsers on Android
236+
#[cfg(target_os = "android")]
237+
#[inline]
238+
fn open_browser_internal(browser: Browser, url: &str) -> Result<ExitStatus> {
239+
Command::new("am").arg("start").arg("--user").arg("0").arg("-a").arg("android.intent.action.VIEW").arg("-d").arg(url).status()
240+
}
241+
235242
/// Deal with opening of browsers on Mac OS X, using `open` command
236243
#[cfg(target_os = "macos")]
237244
#[inline]
@@ -343,6 +350,7 @@ fn open_on_unix_using_browser_env(url: &str) -> Result<ExitStatus> {
343350
}
344351

345352
#[cfg(not(any(
353+
target_os = "android",
346354
target_os = "windows",
347355
target_os = "macos",
348356
target_os = "linux",

0 commit comments

Comments
 (0)