I use followoing permission to make phone call from my application
< uses-permission android:name="android.permission.CALL_PHONE" />
Here is my code for making call.
 Intent iniCall=new Intent(Intent.ACTION_CALL);
 iniCall.setData(Uri.parse("tel:9849199291");
 startActivity(iniCall);   
But It start the Skype Application instead of starting Default Calling Application.
How to call from default calling application?
For Pre-Lollipop devices you need to use com.android.phone as package name and in Lollipop you need to use com.android.server.telecom as package name.
Try this code:
Intent iniCall=new Intent(Intent.ACTION_CALL);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
   iniCall.setPackage("com.android.server.telecom"); 
}else{
   iniCall.setPackage("com.android.phone"); 
} 
iniCall.setData(Uri.parse("tel:"+9849199291);
startActivity(iniCall); 
I hope it helps!
mainactivity code:
  button.setOnClickListener(new OnClickListener() {
    @Override
   public void onClick(View arg0) {
    String phnum = edittext.getText().toString();
    Intent callIntent = new Intent(Intent.ACTION_CALL);
    callIntent.setData(Uri.parse("tel:" + phnum));
    startActivity(callIntent);
   }
  });
manifest:
<uses-permission android:name="android.permission.CALL_PHONE" />
                        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