I am programming an app, that automatically answers a call. The problem is, that it should not answer one if I am already in a call and someone is ringing. Is there a way to achieve that?
According to the doc, if I check the status with TelephonyManager
it would be CALL_STATE_RINGING
and not CALL_STATE_OFFTHEHOOK
.
Do I have to add a variable that is set true on a changing Telephone state so I know that there is an ongoing call or is there a better solution?
Thanks!
/edit: I answer the call without the permission Modify_Phone_State
, so it is only about finding out if there is already a call ongoing.