Logo Icon Logo
A Crowd-sourced Cookbook on Writing Great Android® Apps
GitHub logo Twitter logo OReilly Book Cover Art
Dialing the PhoneBack to Android Cookbook Home | Up to Chapter: Telephone Applications

Author: Ian Darwin ('idarwin')
In Published Edition? Yes
FormatLanguage: WikiFormat

Dialing the Phone


You want to dial the phone from within an application, without worrying about details of telephony.


Start an Intent to dial the phone.


One of the beauties of Android is the ease with which applications can re-use other applications, without being tightly coupled to the details (or even name) of the other program, using the Intent mechanism. For example, to call the phone, you only need to create and start an Intent with the action of DIAL and the "URI" of "tel" + the number you want to dial. Thus, a basic dialer can be as simple as this:

public class Main extends Activity {
	String phoneNumber = "555-1212";
	String intentStr = "tel:" + phoneNumber;
    /** Standard creational callback.
     * Just dial the phone
    public void onCreate(Bundle savedInstanceState) {
        Intent intent = new Intent("android.intent.action.DIAL", 

You need to have the permission android.permission.CALL_PHONE to use this code. The user will see this screen, and users know to press the green Phone button to let the call procede.

Typically in real life you would not hard-code the number. In other circumstances you might want the user to call a number from the phone's Contacts list.

See Also