拨打电话相并功能


直接拨打电话


public static void call(String phoneNumber) {
    try {
        Intent intent = new Intent(Intent.ACTION_CALL);
        intent.setData(Uri.parse("tel:" + phoneNumber));
        startActivity(intent);
    } catch (Exception e) {
        Log.e("SampleApp", "Failed to invoke call", e);
    }
}

跳转至拨号界面

public static void callDial(Context context, String phoneNumber) {
     context.startActivity( new Intent(Intent.ACTION_DIAL, Uri.parse( "tel:" + phoneNumber)));
}
相关标签

扫一扫

在手机上阅读