A can get all installed web browsers by using this code:
ArrayList<String> allLaunchers = new ArrayList<String>();
Intent allApps = new Intent(Intent.ACTION_MAIN);
List<ResolveInfo> allAppList = getPackageManager().queryIntentActivities(allApps, 0);
for(int i =0;i<allAppList.size();i++) allLaunchers.add(allAppList.get(i).activityInfo.packageName);
Intent myApps = new Intent(Intent.ACTION_VIEW);
myApps.setData(Uri.parse("http://www.google.es"));
List<ResolveInfo> myAppList = getPackageManager().queryIntentActivities(myApps, 0);
for(int i =0;i<myAppList.size();i++){
if(allLaunchers.contains(myAppList.get(i).activityInfo.packageName)){
Log.e("match",myAppList.get(i).activityInfo.packageName+"");
}
}
link: Android Fetch installed and default browser in device
Based on package name, is there a way to get BOOKMARKS URI for each browser?
When I got list of browsers, by package name (via above method), I need to get a link for it's bookmarks (browsing history) database, for example:
On Chrome, package name is com.android.chrome
and history URI is content://com.android.chrome.browser/bookmarks
, but this case is special one, when only .browser
was added to real package name... in most cases it differs totally. Like in FF, where package name is org.mozilla.firefox
, and history uri differs: content://org.mozilla.firefox.db.browser/bookmarks
(yes, I know that It can't be read in FF), but was only an example.
So basically the question is: Is there a way, knowing this: org.mozilla.firefox
, to get this: content://org.mozilla.firefox.db.browser/bookmarks
.