Android 拨打电话功能

Android拨打电话有两种方式,一种直接拨打,一种跳到拨号页面需用户手动点击拨出

不管哪种都需要拨打电话权限,在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);

猜你喜欢

转载自geoffrey-qiao.iteye.com/blog/2288928