CallStateListener
interface CallStateListener
| android.telephony.TelephonyCallback.CallStateListener | 
Interface for call state listener.
Summary
| Public methods | |
|---|---|
| abstract Unit | onCallStateChanged(state: Int)Callback invoked when device call state changes. | 
Public methods
onCallStateChanged
abstract fun onCallStateChanged(state: Int): Unit
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 TelephonyManager object which registers TelephonyCallback by TelephonyManager.registerTelephonyCallback(Executor, TelephonyCallback). If this TelephonyManager object was created with TelephonyManager.createForSubscriptionId(int), then the callback applies to the subscription ID. Otherwise, this callback applies to SubscriptionManager.getDefaultSubscriptionId(). 
 Note: The state returned here may differ from that returned by TelephonyManager.getCallState(). Receivers of this callback should be aware that calling TelephonyManager.getCallState() from within this callback may return a different state than the callback reports. 
 Requires android.Manifest.permission#READ_PHONE_STATE
| Parameters | |
|---|---|
| state | Int: the current call state Value is android.telephony.TelephonyManager#CALL_STATE_IDLE,android.telephony.TelephonyManager#CALL_STATE_RINGING, orandroid.telephony.TelephonyManager#CALL_STATE_OFFHOOK | 
