Created
February 25, 2020 01:54
-
-
Save sethsandaru/383b9e0130f6c0eda04fb4b3e46d537b to your computer and use it in GitHub Desktop.
Android Java Force Intent to open URL in Google Chrome
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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