public class ScoreUtil {

    /**
     * 去应用商城
     * @param context
     * @param myAppPkg 当前app包名
     * @param shopPkg   指定应用商城包名
     */
    public static void goAppShop(Context context, String myAppPkg, String shopPkg) {
        if (TextUtils.isEmpty(myAppPkg)) {
            return;
        }

        try {
            Uri uri = Uri.parse("market://details?> 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, "");
        }
    }
}

 

 

 

End

相关文章:

  • 2021-05-28
  • 2022-12-23
  • 2021-06-21
  • 2022-02-27
  • 2022-12-23
  • 2021-08-19
  • 2021-11-02
猜你喜欢
  • 2021-11-23
  • 2021-08-07
  • 2021-08-02
  • 2021-08-02
  • 2022-12-23
  • 2021-12-28
  • 2022-12-23
相关资源
相似解决方案