在我的 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/