Show a specific app in Google Play - Android Intent

Android examples for Intent:App Market

Description

Show a specific app in Google Play

Demo Code


//package com.java2s;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;

public class Main {
    /**//from w  w w . j  a  v  a  2s  .co  m
     * Show a specific app in Google Play
     *
     * @param a
     * @param packageId Unique package id of the app to show
     */
    public static void showAppInGooglePlay(Activity a, String packageId) {
        try {
            a.startActivity(new Intent(Intent.ACTION_VIEW, Uri
                    .parse("market://details?id=" + packageId)));
        } catch (android.content.ActivityNotFoundException anfe) {
            a.startActivity(new Intent(Intent.ACTION_VIEW, Uri
                    .parse("http://play.google.com/store/apps/details?id="
                            + packageId)));
        }
    }
}

Related Tutorials