I am writing a launcher and I need to find the dialer, browser, sms and camera app to put as shortcuts on the dock.
I assume different vendors like Samsung/HTC/Google will all have different apps for each of these with different package names.
Is there a way to use the PackageManager to get the default dialer app for example?
EDIT:
As per the advice given below I ended up implementing it like this:
Intent i = new Intent(Intent.ACTION_CALL);
i.setData(Uri.parse("tel:123456789"));
ResolveInfo resolveInfo = pm.resolveActivity(i, 0);
AppModel result = null;
if (resolveInfo != null) {
ActivityInfo activityInfo = resolveInfo.activityInfo;
if (activityInfo != null) {
if ("android".equals(activityInfo.packageName)) {
// no default activity.. choose first
List<ResolveInfo> resolveInfos = m.queryIntentActivities(i, 0);
for (ResolveInfo rInfo : resolveInfos) {
result = new AppModel(context, rInfo.activityInfo.applicationInfo);
break;
}
} else {
ApplicationInfo appInfo = activityInfo.applicationInfo;
if (appInfo != null) {
result = new AppModel(context, appInfo);
}
}
}
}