如何在Android设备上找到默认浏览器设置 [英] How to find default browser set on android device

查看:37
本文介绍了如何在Android设备上找到默认浏览器设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法可以找出在安卓设备上哪个浏览器被设置为默认浏览器?在安卓设备上可能安装了多个浏览器,但其中只有一个设置为默认浏览器.我需要以编程方式找到它.

Is there any way to find out which browser is set as a default browser on android device? On android device there may be multiple browsers installed but out of which only one set as a default. I need to find it out programmatically.

提前致谢.早期响应表示赞赏..

Thanks in advance. Early response is appreciated..

推荐答案

此代码可能对您有所帮助:

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 packageName
String packageName = resolveInfo.activityInfo.packageName;

如果要启动它,请执行以下操作:

and if wanna start it, do as follows:

startActivity(getPackageManager().getLaunchIntentForPackage(packageName));

这篇关于如何在Android设备上找到默认浏览器设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆