As we've seen in previous recipes, we can call the default applications simply by using an Intent. There are two Intents for phone calls:
- ACTION_DIAL: Uses the default phone application to make the phone call (no permission required)
- CALL_PHONE: Bypasses the UI to directly dial the number (requires permission)
Here's the code to set and call the Intent for using the default Phone app:
Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:" + number)); startActivity(intent);
Since your application is not doing the dialing and the user must press the Dial button, your app does not need any dialing permissions. The recipe that follows will show you how to place a call directly, bypassing the Dialer app.