如何选中默认SIM卡进行拨打电话

时间:2017-06-23 09:43:08

标签: android provider phone-call sim-card

有没有办法检查默认SIM卡是否已选择拨打电话?

我使用以下代码进行make call,

 Intent intent = new Intent(Intent.ACTION_CALL);
          intent.setData(Uri.parse("tel:" + phoneNO));
          intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          intent.addFlags(Intent.FLAG_FROM_BACKGROUND);
          if (ActivityCompat.checkSelfPermission(context, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
              // TODO: Consider calling
              //    ActivityCompat#requestPermissions
              // here to request the missing permissions, and then overriding
              //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
              //                                          int[] grantResults)
              // to handle the case where the user grants the permission. See the documentation
              // for ActivityCompat#requestPermissions for more details.
              return;
          }
          context.startActivity(intent);

0 个答案:

没有答案