Android: How to show a list of dialer app installed on my device instead of directly calling default dialer

感情迁移 提交于 2019-12-12 05:56:08

问题


Android: How to show a list of dialer app installed on my device instead of directly calling default dialer

Intent intent = new Intent(Intent.ACTION_CALL);
startActivity(intent); 

permission -

<uses-permission android:name="android.permission.CALL_PHONE" /> 

So with this code the deault dialer app gets called. I want the behavior where Android suggest me the list of apps that could be used for calling feature.


回答1:


You can not show list of dialer while using ACTION_CALL intent.

You need a special permission because the ACTION_CALL is a protected action, allow you to call a phone number directly, with no interaction from the user.

You can make Intent chooser for ACTION_DIAL intent which allows you to show list of apps which has dialer. You can use this code.

final Intent intent = new Intent();
intent.setAction(Intent.ACTION_DIAL);
intent.setData(Uri.fromParts("tel", "123456", null));
startActivity(Intent.createChooser(intent, ""), REQUEST_CODE));

I hope it helps!



来源:https://stackoverflow.com/questions/32044423/android-how-to-show-a-list-of-dialer-app-installed-on-my-device-instead-of-dire

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