小编Ash*_*sha的帖子

Intent Action_dial 在 android 11 中不起作用

我目前正在开发一个 Android 应用程序,需要一个启动电话的功能,所以我添加了这段代码。

 public void dialPhoneNumber(String phoneNumber) {
        Intent intent = new Intent(Intent.ACTION_DIAL);
            intent.setData(Uri.parse("tel:" + phoneNumber));
            if (intent.resolveActivity(getPackageManager()) != null) {
                startActivity(intent);
            }
        }
Run Code Online (Sandbox Code Playgroud)

..它似乎在旧的 Android 版本中完美工作,但是当我在 Android 11 中测试它时,它根本不起作用我尝试action_call并添加了权限<uses-permission android:name="android.permission.CALL_PHONE" />仍然不起作用。

java android android-studio

5
推荐指数
1
解决办法
5405
查看次数

标签 统计

android ×1

android-studio ×1

java ×1