Last active
August 29, 2015 14:00
-
-
Save neilbantoc/07fc718c6506126f4a18 to your computer and use it in GitHub Desktop.
Open or install an app
This file contains 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
public static void openOrInstallApp(Context context, String packageName) { | |
Intent intent = context.getPackageManager().getLaunchIntentForPackage(packageName); | |
if (intent == null) { | |
intent = new Intent(Intent.ACTION_VIEW); | |
intent.setData(Uri.parse("market://details?id=" + packageName)); | |
// intent.setData(Uri.parse("http://play.google.com/store/apps/details?id=" + packageName)); | |
} | |
context.startActivity(intent); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment