Program to make a phone call in Android Phone

private void makecall()
{
try {
Intent phonecallIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:9884179964"));
startActivity(phonecallIntent);
}
catch (ActivityNotFoundException activityException)
{
Log.e("makeCallDemo", "Call failed", activityException);
}
}
So, in the above example the instance of Intent class will actually search for the application which provides ACTION_CALL action in this case PhoneApp and tell the android system that we want to start a phone call. The startActivity method will actually initiate the phone call to the provided number. The phone number provided above should follow the E.164 Number format.
0 comments:
Post a Comment