Bex
Bex

Reputation: 4918

Confused with call state

I want to detect when an incoming call is ringing, when the call is in progress and when it ends. I am looking at the call states:

public class MyPhoneStateListener extends PhoneStateListener {
      public void onCallStateChanged(int state,String incomingNumber){
      switch(state){
        case TelephonyManager.CALL_STATE_IDLE:

        break;
        case TelephonyManager.CALL_STATE_OFFHOOK:

        break;
        case TelephonyManager.CALL_STATE_RINGING:

        break;
        }
      } 
    }

I may be misinterpreting the English but does offhook mean "during call" and when it's idle does that mean that the call has ended or the actual call is taking place but somehow idle?

The documentation is a little vague!

Upvotes: 1

Views: 1809

Answers (1)

Jan Dragsbaek
Jan Dragsbaek

Reputation: 8101

The documentation says:

Device call state: Off-hook. At least one call exists that is dialing, active, or on hold, and no calls are ringing or waiting.

I believe it is quite self-explanatory

Upvotes: 4

Related Questions