-2

Need to make calls from my application, without invoking the default dialer Activity, i.e. my application's activity should complete the dial-out, conversation and hang-up operations.

Note that the usual way of invoking the default dialer Activity done as follows, is not what I need:

 String nber = phone.getText().toString();
        Intent callIntent = new Intent(Intent.ACTION_CALL);
        callIntent.setData(Uri.parse("tel:" + nber));
        startActivity(callIntent);
bdutta74
  • 2,798
  • 3
  • 31
  • 54
Valera Valerianov
  • 247
  • 1
  • 3
  • 14
  • Check out: http://stackoverflow.com/questions/5029183/android-dialer-application – bdutta74 Dec 26 '14 at 06:41
  • 1
    Especially CALL_PRIVILEGED permission answers. Note that Google has discouraged it's use. From what I understand, the only way you achieve what you are want -- if I understanding it correctly, is to replace the default dialler, i.e. default dialer Activity shouldn't be opened, but your own. However, this is possible because application like TrueDialler and other replacement Dialer applications seem to be able to do it. – bdutta74 Dec 26 '14 at 06:45
  • @icarus74 Do agree with you – IntelliJ Amiya Dec 26 '14 at 06:49
  • @icarus74 I tried an example for your reference. I have nothing happened. and I took the question to edit. may return the rating? – Valera Valerianov Dec 26 '14 at 07:18
  • Note that I did not down-vote. I can however upvote. – bdutta74 Dec 26 '14 at 07:53
  • thank you so much. just because someone lowered me could block. I have studied the link you gave. there is a slightly different problem. he wants to when you press the "call" is caused by its application. I also want to when you press the "call" which in my application does not open the default Activity and immediately initiate a call directly from the program. – Valera Valerianov Dec 26 '14 at 08:03
  • ^Valera, I think I completely understand what you are trying to achieve. I was looking for something very similar few months back, but didn't make much progress. I think the answer lies in figuring out how custom dialer applications work. I've not had the time to do so. It is likely to require ITelephony AIDL, but I am not sure. Some clues here: http://stackoverflow.com/questions/18977012/why-itelephony-aidl-works – bdutta74 Dec 26 '14 at 13:16

2 Answers2

1

Try this

    String nber = "tel:" + phone.getText().toString().trim();
    Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse(nber)); 
    startActivity(callIntent);

And give Manifest permission

<uses-permission android:name="android.permission.CALL_PHONE" />
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
  • Can not you see that I wrote in my question exactly the same code as you have? and pointed out that I did not need a standard solution, and it is necessary to make a call from my Activity. You wrote to me exactly the same code as in my question. I know how to do it and ask a decision different from that. @Yogendra understood me and wrote an example. but it just does not quite work as they should – Valera Valerianov Dec 26 '14 at 06:14
0
Intent calltoDoctor = new Intent(Intent.ACTION_CALL);
calltoDoctor.setData(Uri.parse("tel:" + personalInformation.getEmgyno()));
startActivity(calltoDoctor);

Add the permission in manifest.

<uses-permission android:name="android.permission.CALL_PHONE" >

try this

KomalG
  • 808
  • 9
  • 18