Android : Detecting caller side ringing state Android

on Saturday, September 6, 2014


I have used PhoneStateListener class to detect the states of the call, i need to detect the phone state at both Caller side and Callie side , with below class i can detect the Ringing state for the incoming calls at Callie side but Ringing state is not trigger at caller side .


Is there anyway to achieve this task ?



public class MyPhoneStateListener extends PhoneStateListener {

public static Boolean phoneRinging = false;

public void onCallStateChanged(int state, String incomingNumber) {

switch (state) {
case TelephonyManager.CALL_STATE_IDLE:
Log.d("DEBUG", "IDLE");
phoneRinging = false;
break;
case TelephonyManager.CALL_STATE_OFFHOOK:
Log.d("DEBUG", "OFFHOOK");
phoneRinging = false;
break;
case TelephonyManager.CALL_STATE_RINGING:
Log.d("DEBUG", "RINGING");
phoneRinging = true;

break;
}
}

}

0 comments:

Post a Comment