在action_call应用程序崩溃....但action_dial设置拨号器上的号码......我也试试这个
<permission android:name="android.permission.CALL_PRIVILEGED"
android:protectionLevel="signature|privileged" />
这是代码.....说应用程序已停止工作......
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_NO_USER_ACTION);
callIntent.setData(Uri.parse("tel:"+Uri.encode(phoneNum.trim())));
try {
startActivity(callIntent);
}
catch (android.content.ActivityNotFoundException ex)
{
ex.printStackTrace();
}
这是清单文件......
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sajid.contactdemo">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".DisplayActivity"></activity>
</application>
***<uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>***
</manifest>