您好,欢迎来到二三四教育网。
搜索
您的当前位置:首页拨打电话 [ DIAL | CALL ]

拨打电话 [ DIAL | CALL ]

来源:二三四教育网

1.拨打电话,跳转到拨号界面,代码如下 Intent.Action.DIAL: action.intent.action.DIAL

Intent intent = new Intent(Intent.ACTION_DIAL);
Uri data = Uri.parse("tel:" + "xxxxxxxxxxx");
intent.setData(data);
startActivity(intent);

此方法好处是无需申请权限,即可直接使用

2.直接拨打电话,不跳转拨号界面 Intent.Action_CALL:android.intent.action.CALL

Intent intent=new Intent(); 
intent.setAction(Intent.ACTION_CALL);   
intent.setData(Uri.parse("tel:" + "xxxxxxxxxxx");
startActivity(intent);

此方法需要申请权限:<uses-permission android:name="android.permission.CALL_PHONE" />
在6.0上需要动态申请权限

点滴记录

Copyright © 2019- how234.cn 版权所有 赣ICP备2023008801号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务