Muhammad Maqsoodur Rehman
Muhammad Maqsoodur Rehman

Reputation: 34287

How to make the call directly programmatically

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?

Upvotes: 3

Views: 2693

Answers (1)

Ajay S
Ajay S

Reputation: 48612

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" />

Upvotes: 4

Related Questions