android APP 跳转到应用商店评分

闲话少说,直接上代码

/**
 * APP 工具类
 *
 * @author chenxuxu
 * @date 2018/2/10
 *
 */
public class AppUtils {

    /**
     * 跳转到应用商店评分
     *
     * @param context
     * @param myAppPkg
     * @param shopPkg
     */
    public static void goAppShop(Context context, String myAppPkg, String shopPkg) {
        if (TextUtils.isEmpty(myAppPkg)) {
            return;
        }

        try {
            Uri uri = Uri.parse("market://details?id=" + myAppPkg);
            Intent intent = new Intent(Intent.ACTION_VIEW, uri);
            if (!TextUtils.isEmpty(shopPkg)) {
                intent.setPackage(shopPkg);
            }
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intent);
        } catch (Exception e) {
            // 如果没有该应用商店,则显示系统弹出的应用商店列表供用户选择
            goAppShop(context, myAppPkg, "");
        }
    }
}

查看应用商店的包名,可以使用当前Activity APP 查看,或者将该应用商店的 apk 下载,拖到 android studio 查看包名;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值