I have to program a security functionallity that call 3 determined user's contacts when something happens. Once one of those users pick up the phone, there won't be more calls.
The problem I found is that there is no way to know if the users is answering the call or not.
Up to now I used the code found in this answer:
@Override
public void onCallStateChanged(int state, String
incomingNumber){
switch(state){
case TelephonyManager.CALL_STATE_OFFHOOK: //Calling
Log.d(TAG, "CALL_STATE_OFFHOOK");
one=true;
prev_state=state;
break;
case TelephonyManager.CALL_STATE_IDLE: //Call ended
Log.d(TAG, "CALL_STATE_IDLE==>"+incoming_nr);
if((prev_state==TelephonyManager.CALL_STATE_OFFHOOK)){
prev_state=state;
if(one){
callNext();
one = false;
}
}
break;
}
}
Does anybody knows if there is any way to know if a user picked up the phone?