I get ActivityNotFoundException
when perform Intent.ACTION_CALL operation. I found many links but all of it couldn't solve my problem.
It sometimes gives me exception like
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.CALL dat=tel:xxx-xxx-xxxx pkg=com.android.phone (has extras) }
I have used the following code in my project
String contact_number="123456789";
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:" + contact_number));
startActivity(callIntent);
I have solved this issue. I have used the following code
String contact_number="123456789";
Intent callIntent = new Intent(Intent.ACTION_CALL);
intent.setPackage("com.android.phone");
callIntent.setData(Uri.parse("tel:" + contact_number));
startActivity(callIntent);
I have replaced this line for Lollipop
intent.setPackage("com.android.phone");
with
intent.setPackage("com.android.server.telecom");