不管哪种都需要拨打电话权限,在AndroidManifest.xml中添加权限设置
<uses-permission android:name="android.permission.CALL_PHONE"/><!-- 拨打电话权限 -->
拨打电话功能实现代码
一、需手动拨出
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNum)); startActivity(intent);
二、直接拨打(建议拨打前给一个提示)
Intent intent = new Intent(Intent. ACTION_CALL, Uri.parse("tel:" + phoneNum)); startActivity(intent);