make call
I'm trying to make a call through my app. But my app dials number from android mobile dial pad. I want my dial pad in my call. My code is
Uri uri=Uri.parse("tel:"); Intent intent=new Intent();intent.setAction(Intent.ACTION_DIAL);
Thanks
I'm trying to make a call through my app. But my app dials number from android mobile dial pad. I want my dial pad in my call. My code is
Uri uri=Uri.parse("tel:"); Intent intent=new Intent();intent.setAction(Intent.ACTION_DIAL);
Thanks
Try this code
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:" + mobile));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
Hope this code helps you.
In manifest add this permission:
<uses-permission android:name="android.permission.CALL_PHONE" />
Then in Activity use this :
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:" + PhoneNO));
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (ActivityCompat.checkSelfPermission(Activityx.this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
startActivity(callIntent);