Created
October 16, 2020 14:03
-
-
Save alvareztech/3c6aa3323a164701f911632ea49158ef to your computer and use it in GitHub Desktop.
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
if (isAppInstalled("com.google.android.apps.maps")) { | |
// Normal process | |
} else { | |
Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com/maps/dir/Current+Location/-17.760294,-63.201106")); | |
startActivity(myIntent); | |
} | |
private boolean isAppInstalled(String uri) { | |
PackageManager pm = getPackageManager(); | |
try { | |
pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES); | |
return true; | |
} catch (PackageManager.NameNotFoundException e) { | |
e.printStackTrace(); | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment