Skip to content

Instantly share code, notes, and snippets.

@sethsandaru
Created February 25, 2020 01:54
Show Gist options
  • Save sethsandaru/383b9e0130f6c0eda04fb4b3e46d537b to your computer and use it in GitHub Desktop.
Save sethsandaru/383b9e0130f6c0eda04fb4b3e46d537b to your computer and use it in GitHub Desktop.
Android Java Force Intent to open URL in Google Chrome
String url = "http://www.example.com";
try {
Uri uri = Uri.parse("googlechrome://navigate?url=" + url);
Intent i = new Intent(Intent.ACTION_VIEW, uri);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
} catch (ActivityNotFoundException e) {
// Chrome is probably not installed
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment