I need to display default browser name and version in android. I am not looking for chrome or firefox or etc.
Asked
Active
Viewed 52 times
1 Answers
0
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));
PackageManager pm = getPackageManager();
final ResolveInfo mInfo = pm.resolveActivity(i, 0);
PackageInfo pInfo = null;
try {
pInfo = getPackageManager().getPackageInfo(
mInfo.activityInfo.packageName, PackageManager.GET_META_DATA);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
Toast.makeText(getApplicationContext()
,pm.getApplicationLabel(mInfo.activityInfo.applicationInfo)
+ " version " + pInfo.versionName,
Toast.LENGTH_LONG)
.show();
keepTrackOfYourStack
- 1,022
- 8
- 16
-
I got "browser Name = Android system" as an output. is it correct ?? and what about default browser version ?? – Abhishek Singh Apr 11 '19 at 21:32
-
Thank you for your help. – Abhishek Singh Apr 12 '19 at 08:56