gpt4 book ai didi

android - 不使用 UI 调用

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:32:42 25 4
gpt4 key购买 nike

有没有一种方法可以在不显示允许用户发起调用的 UI 的情况下调用联系人?因此,当我点击一个按钮时,会立即调用联系电话,就像我在手机中点击某人的最后一个电话一样,他们会立即被调用。

我现在使用的代码是:

try {
Intent intent = new Intent(Intent.CALL_ACTION);
intent.setData(Uri.parse("tel:" + number));
startActivity(intent);
} catch (Exception e) {
Log.e("SampleApp", "Failed to invoke call", e);
}

最佳答案

向 list 添加权限android.permission.CALL_PHONE并将Intent.CALL_ACTION更改为Intent.ACTION_CALL

关于android - 不使用 UI 调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6465156/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com