Is there a way to call a contact without showing a UI that allows the user to initiate a call? So when I click on a button, the contact number is immediately dialed like when I go to the last calls in my phone an click on someone, they are immediately called.
The code I am using right now is:
try {
Intent intent = new Intent(Intent.CALL_ACTION);
intent.setData(Uri.parse("tel:" + number));
startActivity(intent);
} catch (Exception e) {
Log.e("SampleApp", "Failed to invoke call", e);
}
Add a permission
android.permission.CALL_PHONEto the manifest and changeIntent.CALL_ACTIONtoIntent.ACTION_CALL