作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 ACTION_CALL Intent 来调用 USSD 代码。我已将 android.permission.PHONE_CALL 添加到 list 文件,但它不起作用并出现权限错误异常。 PS:如您所见,也有 GPS 和 INTERNET 的权限,并且它们工作正常。以下是代码:
public void onClick(View v) {
String encodedHash = Uri.encode("#");
String number = "*140*1";
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setPackage("com.android.phone");
intent.setData(Uri.parse("tel:" + number + encodedHash));
try{
startActivity(intent);
} catch(Exception ex){
Toast.makeText(getApplication(), ex.toString(), Toast.LENGTH_LONG).show();
}
}
list
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.PHONE_CALL" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity .......
最佳答案
我想你拼错了文本,更改为以下内容:android.permission.CALL_PHONE
关于android.permission.PHONE_CALL 添加到 list 中但仍然出现权限错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27479656/
我已经实现了 Dexter在我的应用程序中。它适用于 CAMERA、EXTERNAL STORAGE 和 INTERNAL STORAGE 权限。我想用 Dexter 的 PHONE_CALL 权限打
我正在尝试使用 ACTION_CALL Intent 来调用 USSD 代码。我已将 android.permission.PHONE_CALL 添加到 list 文件,但它不起作用并出现权限错误异常
我是一名优秀的程序员,十分优秀!