Android Intent ACTION_CALL 不打电话

标签 android android-intent action android-dialer

在我的 Android应用程序我想在用户单击按钮时自动调用电话。我已经使用下面的一组代码来实现这个功能

Intent intent = new Intent(Intent.ACTION_CALL);
                intent.setData(Uri.parse("tel:911"));
                startActivity(intent);

在我的 AndroidManifest.xml我已经添加了这个 <uses-permission android:name="android.permission.CALL_PHONE" />也许可。

但它只是用给定的 911 打开拨号盘不,而不是打电话。

最佳答案

至少在美国,911 是一个紧急电话号码。 CALL_PHONE 不足以调用该号码。有一个单独的权限(CALL_PRIVILEGED?),普通 SDK 应用程序无法拥有的权限。

更新:我没记错。这是该权限的 Android 6.0 平台 list 条目:

<!-- @SystemApi Allows an application to call any phone number, including emergency
         numbers, without going through the Dialer user interface for the user
         to confirm the call being placed.
         <p>Not for use by third-party applications. -->
    <permission android:name="android.permission.CALL_PRIVILEGED"
        android:protectionLevel="signature|privileged" />

关于Android Intent ACTION_CALL 不打电话,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37073123/

相关文章:

java - 运算符 == 不能应用于 java.lang.String char

android - 我卡在我的 Android 程序上了

xml - 将文本/xml 读入 ASP.MVC Controller

ios - Touch 开始无法在 xcode 中使用 sprite kit 正常运行

当我回来时,viewpager 中的 Android fragment 是空的

java - 在Android中处理大量的EditText数据

android - 火力地堡 "Failed to convert a value of type java.util.HashMap to int"

android - 启动画面不首先显示在应用程序上

android - 打算在 Android 上打开 Instagram 用户个人资料

c# - 有没有办法概括 Action 和 Action<T>?