Android 打开应用市场中的某个应用下载页面

public void launchAppDetail(Context context, String appPkg, String marketPkg) {
        try {
            if (TextUtils.isEmpty(appPkg))
                return;
            Uri uri = Uri.parse("market://details?id=" + appPkg);
            Intent intent = new Intent(Intent.ACTION_VIEW, uri);
            //如果设置了market包名 打开指定app市场
            if (!TextUtils.isEmpty(marketPkg))
                intent.setPackage(marketPkg);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intent);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }



*example* ==》   

//选择手机中的一个应用市场打开

 launchAppDetail(getApplicationContext(), "com.qihoo.appstore", "");

//指定腾讯应用宝打开 (需判断应用宝是否安装)

launchAppDetail(getApplicationContext(), "com.qihoo.appstore", "com.tencent.android.qqdownloader");

你可能感兴趣的:(Android 打开应用市场中的某个应用下载页面)