Open Android market (Google Play Store) using Intent

To open google play store (Android market) using intent, just use the code snippet

String appName = "";  
Uri uri = Uri.parse("market://details?id=" + appName);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
if (isAvaialable(intent, mContext)) {
} else {
Uri uri = Uri.parse(""+appName);

public static boolean isAvailable(Context ctx, Intent intent) {
   final PackageManager mgr = ctx.getPackageManager();
   List list = mgr.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
   return list.size() > 0;
isAvailable() is an utility method that I got from


  1. Instead of using one intent and reacting to the exception I think it's better to first check for availability and use the correct one right away.

    I've written a blog post on how to check for Intent availability:

    1. Creating exception and reacting to it is not a good thing. So I updated my post. Thanks Wolfram.


Post a Comment

Popular posts from this blog

Open Gallery and get the selected image in appplication

Dismiss or Cancel dialog by swipe gesture

AlarmManager and Notification in Android