Dialer Shortcut
Phone Number Display
Android Tips
Smartphone Features
Mobile Usability

How do I get the dialer to open with phone number displayed?

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Introduction

On Android, the normal way to open the phone app with a number already filled in is to launch an intent with ACTION_DIAL and a tel: URI. That opens the dialer screen without placing the call automatically, which is usually the correct balance of usability, user control, and permission safety.

Core Sections

Use ACTION_DIAL instead of direct calling

If you only want the dialer to open with the number displayed, use Intent.ACTION_DIAL. This tells Android to hand the request to a dialer app and let the user decide whether to place the call.

kotlin
1import android.content.Context
2import android.content.Intent
3import android.net.Uri
4
5fun openDialer(context: Context, phoneNumber: String) {
6    val intent = Intent(Intent.ACTION_DIAL).apply {
7        data = Uri.parse("tel:$phoneNumber")
8    }
9    context.startActivity(intent)
10}

The tel: prefix is required. Without it, Android does not know that the data should be treated as a telephone URI.

The important benefit of ACTION_DIAL is that it does not need the dangerous CALL_PHONE permission. Your app is only opening the dialer UI, not initiating the call itself.

Wire it to an activity button

In a normal activity, you trigger the helper from a click handler.

kotlin
1import android.os.Bundle
2import android.widget.Button
3import androidx.appcompat.app.AppCompatActivity
4
5class MainActivity : AppCompatActivity() {
6    override fun onCreate(savedInstanceState: Bundle?) {
7        super.onCreate(savedInstanceState)
8        setContentView(R.layout.activity_main)
9
10        findViewById<Button>(R.id.callButton).setOnClickListener {
11            openDialer(this, "+14165550123")
12        }
13    }
14}

That keeps the action simple and predictable. The user taps a button, sees the dialer, verifies the number, and then decides whether to continue.

Validate or normalize the phone number first

Real-world phone numbers often come from user input, databases, or APIs. They may include spaces, parentheses, hyphens, or other formatting characters. Dialers often tolerate many of those, but it is still better to normalize the value before building the URI.

kotlin
1fun normalizePhone(raw: String): String {
2    return raw.filter { it.isDigit() || it == '+' }
3}
4
5val raw = "(416) 555-0123"
6val normalized = normalizePhone(raw)
7openDialer(this, normalized)

This is a basic cleanup step, not a full phone-number validation system. If the app handles international numbers seriously, a dedicated library such as Google’s libphonenumber is a better choice.

Check whether a dialer exists

Most Android devices have a dialer app, but that is not guaranteed in every environment. Tablets, emulators, kiosk devices, or custom builds may not have an activity that can handle the dial intent.

kotlin
1fun openDialerSafely(context: Context, phoneNumber: String) {
2    val intent = Intent(Intent.ACTION_DIAL, Uri.parse("tel:$phoneNumber"))
3    if (intent.resolveActivity(context.packageManager) != null) {
4        context.startActivity(intent)
5    }
6}

This extra check avoids crashes on unusual devices and makes the code more robust in testing environments.

ACTION_DIAL versus ACTION_CALL

A common source of confusion is the difference between ACTION_DIAL and ACTION_CALL.

  • 'ACTION_DIAL opens the dialer with the number shown.'
  • 'ACTION_CALL attempts to place the call immediately.'

ACTION_CALL requires the CALL_PHONE permission and, on modern Android, runtime permission handling as well. For most apps, using ACTION_CALL is unnecessary and creates more permission surface than the feature needs.

If the product requirement is only “show the number in the dialer,” ACTION_DIAL is the better API.

Compose screens use the same intent pattern

If the screen is written with Jetpack Compose, the dialer logic does not change. You still build the intent the same way; you just call it from a composable event handler.

kotlin
1import androidx.compose.material3.Button
2import androidx.compose.material3.Text
3import androidx.compose.runtime.Composable
4import androidx.compose.ui.platform.LocalContext
5
6@Composable
7fun DialerButton() {
8    val context = LocalContext.current
9    Button(onClick = { openDialerSafely(context, "+14165550123") }) {
10        Text("Open Dialer")
11    }
12}

The UI toolkit changes, but the Android intent model stays the same.

Common Pitfalls

  • Forgetting the tel: prefix causes the intent data to be malformed for dialer handling.
  • Using ACTION_CALL when ACTION_DIAL is enough adds unnecessary permission complexity.
  • Passing raw, unnormalized phone-number text can lead to inconsistent behavior across devices and dialer apps.
  • Launching the intent without checking for a handler can crash on devices without a dialer application.
  • Testing only on one emulator can hide manufacturer-specific dialer behavior that appears on real phones.

Summary

  • Use Intent.ACTION_DIAL with a tel: URI to open the dialer with a number displayed.
  • 'ACTION_DIAL is usually preferable because it does not place the call directly and does not require CALL_PHONE.'
  • Normalize or validate user-provided phone numbers before creating the URI.
  • Check resolveActivity for safer behavior on unusual devices.
  • The same approach works from both traditional Android views and Jetpack Compose screens.

Related reading
Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.