I'm doing an app that record call (both of them, incoming and outgoing calls).
I've just resolved the problem of recording audio from incoming calls, but I've found some troubles with outgoing calls.
My situation is next. I'd like to record audio only when the call is accepted, but I don't know how to do it. I've just tried using PhoneStateListener class, but the call state doesn't change when the call is accepted. I've next code:
package com.call.record.listeners;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.util.Log;
public class OutgoingPhoneStateListener extends PhoneStateListener{
private String phoneNumber;
public OutgoingPhoneStateListener(String pn) {
// TODO Auto-generated constructor stub
super();
phoneNumber = pn;
}
public void onCallStateChanged(int state, String incomingNumber){
switch(state){
case TelephonyManager.CALL_STATE_IDLE:
Log.d("DEBUG", "IDLE");
break;
case TelephonyManager.CALL_STATE_OFFHOOK:
Log.d("DEBUG", "OFFHOOK");
break;
case TelephonyManager.CALL_STATE_RINGING:
Log.d("DEBUG", "RINGING");
break;
}
}
}
In previous code, when a call is outgoing