Stay organized with collections
Save and categorize content based on your preferences.
TelephonyCallback.CallStateListener
public
static
interface
TelephonyCallback.CallStateListener
android.telephony.TelephonyCallback.CallStateListener
|
Interface for call state listener.
Summary
Public methods |
abstract
void
|
onCallStateChanged(int state)
Callback invoked when device call state changes.
|
Public methods
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# TelephonyCallback.CallStateListener\n\nAdded in [API level 31](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nTelephonyCallback.CallStateListener\n===================================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/telephony/TelephonyCallback.CallStateListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nTelephonyCallback.CallStateListener\n`\n\n\n`\n\n\n`\n\n|-------------------------------------------------------|\n| android.telephony.TelephonyCallback.CallStateListener |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nInterface for call state listener.\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[onCallStateChanged](/reference/android/telephony/TelephonyCallback.CallStateListener#onCallStateChanged(int))`(int state) ` Callback invoked when device call state changes. |\n\nPublic methods\n--------------\n\n### onCallStateChanged\n\nAdded in [API level 31](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onCallStateChanged (int state)\n```\n\nCallback invoked when device call state changes.\n\n\nReports the state of Telephony (mobile) calls on the device for the registered\nsubscription.\n\n\nNote: the registration subscription ID comes from [TelephonyManager](/reference/android/telephony/TelephonyManager) object\nwhich registers TelephonyCallback by\n[TelephonyManager.registerTelephonyCallback(Executor, TelephonyCallback)](/reference/android/telephony/TelephonyManager#registerTelephonyCallback(java.util.concurrent.Executor,%20android.telephony.TelephonyCallback)).\nIf this TelephonyManager object was created with\n[TelephonyManager.createForSubscriptionId(int)](/reference/android/telephony/TelephonyManager#createForSubscriptionId(int)), then the callback applies to the\nsubscription ID. Otherwise, this callback applies to\n[SubscriptionManager.getDefaultSubscriptionId()](/reference/android/telephony/SubscriptionManager#getDefaultSubscriptionId()).\n\n\nNote: The state returned here may differ from that returned by\n[TelephonyManager.getCallState()](/reference/android/telephony/TelephonyManager#getCallState()). Receivers of this callback should be aware that\ncalling [TelephonyManager.getCallState()](/reference/android/telephony/TelephonyManager#getCallState()) from within this callback may return a\ndifferent state than the callback reports.\n\n\u003cbr /\u003e\n\n\nRequires [Manifest.permission.READ_PHONE_STATE](/reference/android/Manifest.permission#READ_PHONE_STATE)\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `state` | `int`: the current call state Value is [TelephonyManager.CALL_STATE_IDLE](/reference/android/telephony/TelephonyManager#CALL_STATE_IDLE), [TelephonyManager.CALL_STATE_RINGING](/reference/android/telephony/TelephonyManager#CALL_STATE_RINGING), or [TelephonyManager.CALL_STATE_OFFHOOK](/reference/android/telephony/TelephonyManager#CALL_STATE_OFFHOOK) \u003cbr /\u003e |"]]