标签:category.browsable android浏览器 android默认浏览器
Android系统可以用如下方法获取默认浏览器信息:
public static ActivityInfo getBrowserApp(Context context) {
String default_browser = "android.intent.category.DEFAULT";
String browsable = "android.intent.category.BROWSABLE";
String view = "android.intent.action.VIEW";
Intent intent = new Intent(view);
intent.addCategory(default_browser);
intent.addCategory(browsable);
Uri uri = Uri.parse("http://");
intent.setDataAndType(uri, null);
// 找出手机当前安装的所有浏览器程序
List<ResolveInfo> resolveInfoList = context.getPackageManager().queryIntentActivities(intent, PackageManager.GET_INTENT_FILTERS);
if (resolveInfoList.size() > 0) {
ActivityInfo activityInfo = resolveInfoList.get(0).activityInfo;
String packageName = activityInfo.packageName;
String className = activityInfo.name;
return activityInfo;
} else {
return null;
}
}
标签:category.browsable android浏览器 android默认浏览器
原文地址:http://blog.csdn.net/liranke/article/details/42491167