Skip to content Skip to sidebar Skip to footer

How To Get Phone Idle State After Incoming Call Is Disconnected?

I can easily get an IDLE state when incoming call get disconnect using PhoneStateListener But I need an IDLE Phone state of Incoming call And condition are : Suppose incoming call

Solution 1:

What you can do is maintain a flag value for each state & then use it in EXTRA_STATE_IDLE to know if its a 1st call or when call is call is currently going on -

if(state.equals(TelephonyManager.EXTRA_STATE_RINGING))
            {           
                      ring =true;  

            }
if(state.equals(TelephonyManager.EXTRA_STATE_OFFHOOK))
         {
                callReceived=true;
          }

and then in idle state use these two flags to know which call it is -

if (state.equals(TelephonyManager.EXTRA_STATE_IDLE))
            {
                      // If phone was ringing(ring=true) and received(callReceived=true) 
                       if(ring==true&&callReceived==true)
                       {
                          Log.i("Detect","Call is currently going on");
                       }
          }

Post a Comment for "How To Get Phone Idle State After Incoming Call Is Disconnected?"