How to find default browser set on android device
This code may help you:
Intent browserIntent = new Intent("android.intent.action.VIEW", Uri.parse("http://")); ResolveInfo resolveInfo = getPackageManager().resolveActivity(browserIntent,PackageManager.MATCH_DEFAULT_ONLY);// This is the default browser's packageNameString packageName = resolveInfo.activityInfo.packageName;
and if wanna start it, do as follows:
startActivity(getPackageManager().getLaunchIntentForPackage(packageName));
You are welcome to use PackageManager
and resolveActivity()
to attempt to determine what activity (in what app) will handle a particular Intent
. However, this may indicate that the chooser will handle the request, because there is no current default (e.g., user just installed a new browser, and so the chooser will appear for the next Web browser request).