Android intent action call

Android intent action call

Я пытаюсь использовать класс Intent.Action. Я знаю, как использовать ACTION_VIEW для отображения URL-адреса, но я хотел использовать Intent.ACTION_DIAL для вызова номера при запуске приложения. В документации говорится, что вам нужно разобрать URI в строке, а затем добавить его в намерение, которое я пробовал:

Это не работает. Я получаю сообщение об ошибке:

К сожалению, проект прекратился. Я попытался отладить код и, похоже, указал мне на линию намерения, не уверен, что я делаю неправильно, если я просто сделаю это, и это приведет к появлению дозвона.

I am trying to use the Intent.Action class. I know how to use the ACTION_VIEW to display a URL but I wanted to use the Intent.ACTION_DIAL to call number when the application is launched. The documentation says you need to parse a URI into a string and then add it to the Intent I tried this:

This doesn’t work I get an error message saying:

Unfortunately, Project has stopped. I tried to debug the code and it seems to point me to the intent line not sure what I doing wrong if I just do this it works and brings up the dialer.

9 Answers 9

To just open the dialer app (the user has to press the call button inside the dialer app; no additional permissions needed) use:

To open the dialer app and do the call automatically (needs android.permission.CALL_PHONE) use:

add this to your AndroidManifest.xml file

add this to your AndroidManifest.xml file

Another approach is to make an PendingIntent to be called later. This is specially util when you want to redirect the user directly to phone call from a notification Action.

Читайте также:  Топ фотки на аву вк для пацанов

I’m using the following code to make a call in Android but it is giving me security exception please help.

20 Answers 20

You can use Intent.ACTION_DIAL instead of Intent.ACTION_CALL . This shows the dialer with the number already entered, but allows the user to decide whether to actually make the call or not. ACTION_DIAL does not require the CALL_PHONE permission.

This demo will helpful for you.

On call button click:

Permission in Manifest:

More elegant option:

Every thing is fine.

i just placed call permissions tag before application tag in manifest file

and now every thing is working fine.

Use the action ACTION_DIAL in your intent, this way you won’t need any permission. The reason you need the permission with ACTION_CALL is to make a phone call without any action from the user.


If you use Intent.ACTION_CALL you must add CALL_PHONE permission.

Its okey only if you don’t want your app to show up in google play for tablets that doesn’t take SIM card or doesn’t have GSM.



So if it is not critical feature to your app, try to stay away from adding CALL_PHONE permission.


Is to show the Phone app with the number written in on the screen, so user will only need to click call button:

No permission needed for this.

Ссылка на основную публикацию