| | |
| | | * @param phone 电话号码 |
| | | */ |
| | | public static void callPhone(final Context context, final String phone){ |
| | | RxPermissions rxPermissions = new RxPermissions((Activity) context); |
| | | rxPermissions.request(Manifest.permission.CALL_PHONE) |
| | | .subscribe(new Consumer<Boolean>() { |
| | | @Override |
| | | public void accept(@NonNull Boolean aBoolean) throws Exception { |
| | | if (!aBoolean) { |
| | | Toast.create(context).show("没有拨号权限!"); |
| | | } else { |
| | | Intent intent = new Intent(Intent.ACTION_DIAL); |
| | | intent.setData(Uri.parse("tel:"+phone)); |
| | | context.startActivity(intent); |
| | | } |
| | | } |
| | | }); |
| | | Intent intent = new Intent(Intent.ACTION_DIAL); |
| | | intent.setData(Uri.parse("tel:"+phone)); |
| | | context.startActivity(intent); |
| | | } |
| | | |
| | | /** |