Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

# TelephonyCallback.CallStateListener

*** ** * ** ***

` public static interface TelephonyCallback.CallStateListener `   
` `

|---|
| android.telephony.TelephonyCallback.CallStateListener |

<br />

*** ** * ** ***

Interface for call state listener.

## Summary

| ### Public methods ||
|---|---|
| ` abstract void` | ` https://developer.android.com/reference/android/telephony/TelephonyCallback.CallStateListener#onCallStateChanged(int)(int state) ` Callback invoked when device call state changes. |

## Public methods

### onCallStateChanged

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void onCallStateChanged (int state)
```

Callback invoked when device call state changes.

Reports the state of Telephony (mobile) calls on the device for the registered subscription.

Note: the registration subscription ID comes from `https://developer.android.com/reference/android/telephony/TelephonyManager` object which registers TelephonyCallback by `https://developer.android.com/reference/android/telephony/TelephonyManager#registerTelephonyCallback(java.util.concurrent.Executor,%20android.telephony.TelephonyCallback)`. If this TelephonyManager object was created with `https://developer.android.com/reference/android/telephony/TelephonyManager#createForSubscriptionId(int)`, then the callback applies to the subscription ID. Otherwise, this callback applies to `https://developer.android.com/reference/android/telephony/SubscriptionManager#getDefaultSubscriptionId()`.

Note: The state returned here may differ from that returned by `https://developer.android.com/reference/android/telephony/TelephonyManager#getCallState()`. Receivers of this callback should be aware that calling `https://developer.android.com/reference/android/telephony/TelephonyManager#getCallState()` from within this callback may return a different state than the callback reports.   

Requires `https://developer.android.com/reference/android/Manifest.permission#READ_PHONE_STATE`

<br />

| Parameters ||
|---|---|
| `state` | `int`: the current call state. Value is one of the following: - `https://developer.android.com/reference/android/telephony/TelephonyManager#CALL_STATE_IDLE` - `https://developer.android.com/reference/android/telephony/TelephonyManager#CALL_STATE_RINGING` - `https://developer.android.com/reference/android/telephony/TelephonyManager#CALL_STATE_OFFHOOK` |