问题
I'm working on an android app where I get list of installed apps using this code:
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> allAppsInstalled = pm.queryIntentActivities(mainIntent, 0);
then I assign each app icon, label and packagename to a recyclerview element where I can launch each package using the appropriate intent
Intent launchIntent = pm.getLaunchIntentForPackage(packageName);
context.startActivity(launchIntent);
Every thing is working fine except for the Contacts and Phone apps, both have the same package name 'com.android.contacts' and both open the same app contacts screen. My question is, how can I make the Phone app open the Dialer not the contacts List ?
来源:https://stackoverflow.com/questions/57576992/android-get-phone-dialer-app-package-instead-of-contacts