I want to get all default apps in Android L. I used bellow code but they give me a wrong solution. Let see my code first
private void getMyAppLauncherDefault() {
final IntentFilter filter = new IntentFilter(Intent.ACTION_MAIN);
filter.addCategory(Intent.CATEGORY_HOME);
List<IntentFilter> filters = new ArrayList<IntentFilter>();
filters.add(filter);
List<ComponentName> activities = new ArrayList<ComponentName>();
final PackageManager packageManager = (PackageManager) getPackageManager();
packageManager.getPreferredActivities(filters, activities, null);
for (ComponentName activity : activities) {
Log.d(TAG,"======packet default:==="+activity.getPackageName());
}
}
And this is log. The log shows a wrong result between com.google.android.googlequicksearchbox
and com.vlingo.midas
. They are both Voice apps, but I set up com.google.android.googlequicksearchbox
as default. I do not know why the log shows com.vlingo.midas
. How can I fix it? Thanks
16:02:44.817 /com.exam D/Sample: ======packet default:===com.sec.android.gallery3d
16:02:44.827 /com.exam D/Sample: ======packet default:===com.android.mms
16:02:44.827 /com.exam D/Sample: ======packet default:===com.android.mms
16:02:44.827 /com.exam D/Sample: ======packet default:===com.vlingo.midas
16:02:44.827 /com.exam D/Sample: ======packet default:===com.sec.android.app.sbrowser
16:02:44.827 /com.exam D/Sample: ======packet default:===com.sec.android.gallery3d
16:02:44.827 /com.exam D/Sample: ======packet default:===com.android.mms
16:02:44.827 /com.exam D/Sample: ======packet default:===com.sec.android.app.launcher
16:02:44.827 /com.exam D/Sample: ======packet default:===com.sec.android.app.sbrowser
16:02:44.827 /com.exam D/Sample: ======packet default:===com.android.mms
16:02:44.827 /com.exam D/Sample: ======packet default:===com.google.android.googlequicksearchbox
16:02:44.827 /com.exam D/Sample: ======packet default:===com.sec.android.app.sbrowser
16:02:44.827 /com.exam D/Sample: ======packet default:===com.sec.android.gallery3d
16:02:44.827 /com.exam D/Sample: ======packet default:===com.android.mms
16:02:44.827 /com.exam D/Sample: ======packet default:===com.google.android.apps.plus
update: There are default app names