How do I dial a number
programmatically from the Android application? I don't want to make a call, which I know I can do by making an intent: new Intent(Intent.ACTION_CALL)
, I just want to take the user to the Android dial prompt, with the number already input by passing it through the intent, so that she has the option to call that number herself.
Intent phoneIntent = new Intent(Intent. ACTION_CALL); You can use ACTION_DIAL action instead of ACTION_CALL, in that case you will have option to modify hardcoded phone number before making a call instead of making a direct call.
Intent intent = new Intent(Intent. ACTION_DIAL); intent. setData(Uri. parse("tel:0123456789")); startActivity(intent);
Use the below code:
Uri number = Uri.parse("tel:123456789"); Intent callIntent = new Intent(Intent.ACTION_DIAL, number); startActivity(callIntent);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With