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.
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.
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.
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.
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.
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_DIALopens the dialer with the number shown.' - '
ACTION_CALLattempts 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.
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_CALLwhenACTION_DIALis 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_DIALwith atel:URI to open the dialer with a number displayed. - '
ACTION_DIALis usually preferable because it does not place the call directly and does not requireCALL_PHONE.' - Normalize or validate user-provided phone numbers before creating the URI.
- Check
resolveActivityfor safer behavior on unusual devices. - The same approach works from both traditional Android views and Jetpack Compose screens.
Related reading
- How do I get the key at a specific index from a Dictionary in Swift?
- How do I get the key at a specific index from a Dictionary in Swift?
- How do I get the RootViewController from a pushed controller?
- How do I get the SharedPreferences from a PreferenceActivity in Android?
- How do I handle ImeOptions' done button click?
- How do I hide a menu item in the actionbar?
- How do I hide the status bar in a Swift iOS app?
- How do I hide the status bar in a Swift iOS app?
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack 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.