Android chrome does not visit apk download url when chrome has a tab

Viewed 447

Just in chrome when it has a tab, when I jump to download a apk by this code , it can not visit. I use other browsers it will be ok, but only in chrome when it has a tab, it is not ok, why? anybody knows?

        Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(url));
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        ResolveInfo resolveInfo = context.getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
        // This is the default browser's packageName
        if (resolveInfo != null) {
            String packageName = resolveInfo.activityInfo.packageName;
            intent.setClassName(packageName, resolveInfo.activityInfo.name);
        }
        context.startActivity(intent);
0 Answers
Related