Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make the call directly programmatically

Tags:

android

I have tried this code here but it merely calls the in built app instead of making a call directly:

 Intent i = new Intent(android.content.Intent.ACTION_DIAL,
 Uri.parse("tel:+" + phoneNumber));
 startActivity(i); 

Any clue?

like image 993
Muhammad Maqsoodur Rehman Avatar asked Apr 25 '26 12:04

Muhammad Maqsoodur Rehman


1 Answers

You can do this simply. It make the call directly.

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

and add this permission in AndroidManifest.xml

<uses-permission android:name="android.permission.CALL_PHONE" />
like image 132
Ajay S Avatar answered Apr 27 '26 01:04

Ajay S



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!