Android get Phone Dialer app package instead of Contacts

坚强是说给别人听的谎言 提交于 2019-12-23 04:47:23

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!