Code360 powered by Coding Ninjas X Code360 powered by Coding Ninjas X
Table of contents
Android Phone Calls
Step 1: Permission for making a call
Step 2: Add a button to make a call
Step 3: Add onClick listener for this button
Key Takeaways  
Last Updated: Mar 27, 2024

Android Phone Calls

Author Pradeep Kumar
0 upvote
Master Python: Predicting weather forecasts
Ashwin Goyal
Product Manager @


In this blog, we will see how we can make a call in an android application. It can be done by using implicit intents with a specific action. We will discuss the step-by-step process of creating an intent to make a phone call by an android application in this article.

In case you are not familiar with intents, I suggest you go through this article before moving forward. 

You can also read about, android operating system

Android Phone Calls

In some cases, we may need to make a phone call using our program; you can accomplish that by using intent with the action ACTION CALL. The intent is a simple message object used to communicate with Android components such as activities, services, broadcast receivers, and content providers. In this case, we are using an intent to make a phone call. Let's discuss the process through an example:

Step 1: Permission for making a call

The first step is to add a user-permission in the AndroidManifest.xml to make a phone call. 


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""

    <!--    Permission to make a call-->
    <uses-permission android:name="android.permission.CALL_PHONE" />

                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />


Step 2: Add a button to make a call

Now, add a button in the activity_main.xml, which on pressed will make a phone call to the specified number. 


<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android=""

    <!--    Code to add a button-->
        app:layout_constraintStart_toStartOf="parent" />

Step 3: Add onClick listener for this button

Now, we will add an on-click listener for this button in the MainActivity.kt file. We will first check if the app has permission to make phone calls or not. If the app doesn't have permission, the makeCall function will just return without making the call. The call will only go through if the app has permission to do so.


import android.Manifest
import android.os.Bundle
import android.widget.Button
import android.content.Intent

class MainActivity : AppCompatActivity() {
    private lateinit var button: Button
    override fun onCreate(savedInstanceState: Bundle?) {
        // Getting the button with call_button id
        button = findViewById<Button>(
        // Add a onClickListener for the button
    // Function to make a call
    private fun makeCall() {
        // Intent with action ACTION_CALL
        val callIntent = Intent(Intent.ACTION_CALL)
        // parsing the number to call = Uri.parse("tel:0377778888")
        // check if the app has permission to make a call
        if (ActivityCompat.checkSelfPermission(
            ) != PackageManager.PERMISSION_GRANTED
        ) {
            //return if the app does not have permission to make a phone call
        // make the phone call


Upon clicking the call button, the second screen will pop up, and the call will go through.

Note: For the call to go through successfully, your app must have permission to make a phone call. You can do so by going to the settings of your phone/emulator and then choosing this app and granting it permission to make a call. 

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job


1. How can we monitor the change in telephony states of a device?
Ans: You can do so by using PhoneStateListener and TelephonyManager class.

2. What is the use of defining user permission in the AndroidManifest.xml file?
Ans: By defining user permission in the file, your device gets to know about the permissions that your app will need. When you go to the settings and check for the app permissions of this app, you will find a request for this specific permission.

3. How does this app know which number to call on the press of the call button?
Ans: The number to call on the press of the button is specified in the MainActivity.kt file. You can change this number as per your liking or even take the number as input from the user. 

Key Takeaways  

In this article, we have extensively discussed the process of making a phone call using intent in an android application. We hope that this blog has helped you enhance your knowledge regarding Android Phone Calls, and to learn more about the type of intents, check out our article on Android Intent Types. And to learn in-depth about android development, check out our Android Development course on the Coding Ninjas website. Do upvote our blog to help other ninjas grow. Happy Coding!

Previous article
Sending SMS in Android
Next article
Android Camera
Live masterclass