Android:如何显示我的设备上安装的拨号器应用列表而不是直接调用默认拨号器
Android: How to show a list of dialer app installed on my device instead of directly calling default dialer
Android:如何显示我设备上安装的拨号程序列表而不是直接调用默认拨号程序
Intent intent = new Intent(Intent.ACTION_CALL);
startActivity(intent);
许可 -
<uses-permission android:name="android.permission.CALL_PHONE" />
所以使用此代码调用默认拨号器应用程序。我想要 Android 向我建议可用于调用功能的应用程序列表的行为。
使用 ACTION_CALL intent 时无法显示拨号器列表。
您需要特殊权限,因为 ACTION_CALL 是一项受保护的操作,允许您直接呼叫 phone 号码,无需用户交互。
您可以为 ACTION_DIAL 意图制作意图选择器,它允许您显示具有拨号器的应用程序列表。您可以使用此代码。
final Intent intent = new Intent();
intent.setAction(Intent.ACTION_DIAL);
intent.setData(Uri.fromParts("tel", "123456", null));
startActivity(Intent.createChooser(intent, ""), REQUEST_CODE));
希望对您有所帮助!
Android:如何显示我设备上安装的拨号程序列表而不是直接调用默认拨号程序
Intent intent = new Intent(Intent.ACTION_CALL);
startActivity(intent);
许可 -
<uses-permission android:name="android.permission.CALL_PHONE" />
所以使用此代码调用默认拨号器应用程序。我想要 Android 向我建议可用于调用功能的应用程序列表的行为。
使用 ACTION_CALL intent 时无法显示拨号器列表。
您需要特殊权限,因为 ACTION_CALL 是一项受保护的操作,允许您直接呼叫 phone 号码,无需用户交互。
您可以为 ACTION_DIAL 意图制作意图选择器,它允许您显示具有拨号器的应用程序列表。您可以使用此代码。
final Intent intent = new Intent();
intent.setAction(Intent.ACTION_DIAL);
intent.setData(Uri.fromParts("tel", "123456", null));
startActivity(Intent.createChooser(intent, ""), REQUEST_CODE));
希望对您有所帮助!