Need to know this so that i could send DTMF and that is going to be my second question!
views:
142answers:
1
+1
A:
You can use the PhoneStateLisenter to listen out for changes in the call state.
So you listen for the LISTEN_CALL_STATE change.
With the onCallStateChanged method.
So when the state changes from RINGING to OFFHOOK you know a phone call has been connected
Same principle applies for IDLE to OFFHOOK in your situation, listen out to the change from IDLE to OFFHOOK and you'll know your connected to a call.
You can also look into the ACTION_NEW_OUTGOING_CALL intent, Android allows you to "trap" this when a call is dialled and you may be able to get a result code back stating whether the call was connected of not.
For DTMF tones look into ToneGenerator, this allows you to create DTMF tones and .startTone() should allow you to play the DTMF tone then
Donal Rafferty
2010-04-14 09:29:07
im calling a Voice response system, so i guess it is not ringing? since my log in the RINGING is not showing in the DDMS, but only IDLE to OFFHOOK? and how do i add dtmf tones with it?
mikedroid
2010-04-14 09:49:25
I have added additional info to my answer, hope it helps
Donal Rafferty
2010-04-14 10:01:55
You cannot "add dtmf tones with it". You cannot play audio into the telephony stream. At best, you can play the DTMF tones on the device, and if the device is in speakerphone mode, those tones *might* get picked up by the microphone.
CommonsWare
2010-04-14 11:42:21
hmm so that means ,the only solution in this case is to add them in the setResultData? (well i did this and IVR can recognize it)
mikedroid
2010-04-14 11:49:24
Using an intent as follows may work also: - Intent mIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" +phoneNumber + ";" + dtmfSequence));
Donal Rafferty
2010-04-14 11:57:28
just the same as setting in the setResultData, i guess that is the only solution! coz my boss wants to know to send dtmf after i got connected to the IVR...
mikedroid
2010-04-14 13:10:34
For now it is yes, There was a comment on the google groups about support for sending dtmf tones during a voice call in future upgrades from a Google developer
Donal Rafferty
2010-04-14 13:36:19
yes i guess i've read that somewhere also hehehe, well thanks for the responses @markmurphy and @donal!
mikedroid
2010-04-14 13:45:07