Android

How to Make a Call

September 3rd 2009 | Posted by msino

One common requirement I see in specifications is to allow the application to make a phone call. The usual way is to use an intent with Intent.ACTION_CALL.

Here’s an example from com.android.phone.PhoneInterfaceManager
String url = createTelUrl(number);
if (url == null) {
return;
}
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse(url));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setClassName(mApp, PhoneApp.getCallScreenClassName());
mApp.startActivity(intent);

createTelUrl is defined in com.android.phone.PhoneInterfaceManager

Don’t forget to add…
<uses-permission id="android.permission.CALL_PHONE"/>

…to your manifest.

Note also that there’s a reported problem on the G1 (RC30) if you wish to send many DTMF tones.

One Response to “How to Make a Call”

Free iPhones…

Two weeks ago my best mate, Andrew Banks, got himself own Nokia N95 Phone. He got it second hand with an Orange SIM but his on O2 so he needed the N95 phone unlocked. He must think I’ m a tech guy and would know how to do it! Or maybe it’ s because I’ …

Leave a Reply:

You must be logged in to post a comment.