Android obtains the default browser Information
The Android system can use the following method to obtain the default browser information:
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 );
// Find all browser programs currently installed on the mobile phone
List 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;
}
}