How to make a phone call using intent in Android?

This demo will helpful for you...

On call button click:

Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "Your Phone_number"));
startActivity(intent);

Permission in Manifest:

 <uses-permission android:name="android.permission.CALL_PHONE" />

EDIT IN 2021

You should write it in your manifest file but at the same time you should ask in runtime.Like this code:

if (ContextCompat.checkSelfPermission(this,android.Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
            ActivityCompat.requestPermissions(this, arrayOf(android.Manifest.permission.CALL_PHONE),
                REQUEST_CODE)

        } else {

// else block means user has already accepted.And make your phone call here.

}

And if you want you can override onRequestPermissionsResult to give user better experience if you write same code with else block here your user will not need to click on your button again after you give permission it will directly call.


You can use Intent.ACTION_DIAL instead of Intent.ACTION_CALL. This shows the dialer with the number already entered, but allows the user to decide whether to actually make the call or not. ACTION_DIAL does not require the CALL_PHONE permission.


More elegant option:

String phone = "+34666777888";
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.fromParts("tel", phone, null));
startActivity(intent);