引用:
https://www.cnblogs.com/shenchanghui/p/6150477.html
1.不用权限
Intent intent = new Intent(Intent.ACTION_DIAL); Uri data = Uri.parse("tel:" + "135xxxxxxxx"); intent.setData(data); startActivity(intent);
2.需要权限
Intent intent = new Intent(Intent.ACTION_CALL); Uri data = Uri.parse("tel:" + "135xxxxxxxx"); intent.setData(data); startActivity(intent);
第一种方法不需要申请权限,可以直接跳转到拨号界面。
第二种方法需要在AndroidMenifest文件里加上这个权限:<uses-permission android:name="android.permission.CALL_PHONE" />,在Android6.0中,还要在代码中动态申请权限。