0

I know how to make a call through code from android. We do something like this.

Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:"+1234567890));
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(callIntent);

but after executing this code the call is initiated but i don't know whether the call was successful or not and if not what was the error or problem.

While sending SMS through code from android we do something like this

SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message,sentPIntent, deliveredPIntent);  

And we get the message status by sending pending intents. Can we do something similar in case of calls as well so that i come to know whether the call was successful or else what was the error ?

  • I think you question is answered in the comments for [this question](http://stackoverflow.com/questions/1556987/how-to-make-a-phone-call-in-android-and-come-back-to-my-activity-when-the-call-i) – wojciii Jul 17 '12 at 09:26
  • What is given in that question is that i'm only able to know states of phones while calling but my requirement is to know whether i'm able to successfully dial a number or not (Successful dial means ring is going on that number irrespective of whether the receiver picks it or not) – vishnu pratap singh Jul 17 '12 at 10:24

1 Answers1

0

AFAIK you are not able to detect if the call was successful or not - just that it began (by intent) and ended (by listening for state changes).

wojciii
  • 4,253
  • 1
  • 30
  • 39
  • Dude ....i tried it but there doesnot seem to be any state difference between following scenarios 1) Make a call and ring goes 2) Make a call and ring doesnot go. – vishnu pratap singh Jul 17 '12 at 10:59
  • There is a bug about it [here](http://code.google.com/p/android/issues/detail?id=15314&q=PhoneStateListener&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars). Also see [other bugs](http://code.google.com/p/android/issues/list?can=2&q=PhoneStateListener&colspec=ID+Type+Status+Owner+Summary+Stars&cells=tiles). – wojciii Jul 17 '12 at 11:37
  • Also, it is good to know the background for this [question](http://stackoverflow.com/questions/11521065/monitor-a-number-by-calling-it-from-android). – wojciii Jul 17 '12 at 12:30
  • yes given above is the background of my question...did u find any ideas after knowing the background ? – vishnu pratap singh Jul 18 '12 at 04:48
  • You could always roll your own android distribution where you modify the Phone app / telephony interface so it exposes more of the internal call states using the public API. – wojciii Jul 18 '12 at 06:50