00 Votes

Android Programming: Dial and Call Telephone Number

Tutorial by Stefan Trost | Last update on 2021-05-14 | Created on 2014-08-30

Today, I would like to show you in this tutorial how to make a call out of a self-programmed App.

At that, I want to introduce two ways to do so: The first possibility only shows the dialer (App in which you can dial numbers) so that the user can decide whether he wants to dial the provided telephone number or not. Using the second possibility, the number is directly dialed and called automatically.

Android Manifest

For both ways, first of all, your App needs the permission to make calls at all.

<uses-permission android:name="android.permission.CALL_PHONE"></uses-permission> 

For this, you can just add this line to the file AndroidManifest.xml.

Show Dialer with Number

The first and certainly the best way to provide calls from an App, is to show the dialer with the with a preset number. With this, the user can decide, whether he would like to call it or not.

Intent intent = new Intent();

For this, first, we are creating a new Intent with ACTION_DIAL. After that, we can pass our telephone number with "tel:" in front and can start this new activity.

Directly call Number

When replacing ACTION_DIAL with ACTION_CALL, the number is called directly without showing the dialer before.

Intent intent = new Intent();

You should only use this possibility if it is absolutely necessary. Especially when it is about out-of-app-calls, we should give the user as much control as possible.

Finally, it could also be that the user only wants to have a look at the telephone number or he only wants to store the number in his phone book. Other users might want to use the landline instead of the smartphone for the call so that they only want to display the telephone number to be able to copy it. You should always have these thoughts in mind when implementing this function.


About the Author

AvatarYou can find Software by Stefan Trost on sttmedia.com. Do you need an individual software solution according to your needs? - sttmedia.com/contact
Show Profile


Related Topics

Android Splash Screen Tutorial

Tutorial | 0 Comments

Android Getting Sound Levels

Open Question | 1 Answer

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.


Ask your own question or write your own article on askingbox.com. That’s how it’s done.