Stay organized with collections
Save and categorize content based on your preferences.
CallStateListener
interface CallStateListener
Interface for call state listener.
Summary
Public methods |
abstract Unit |
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# TelephonyCallback.CallStateListener\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nCallStateListener\n=================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/telephony/TelephonyCallback.CallStateListener \"View this page in Java\") \n\n```\ninterface CallStateListener\n```\n\n|------------------------------------------------------------|\n| [android.telephony.TelephonyCallback.CallStateListener](#) |\n\nInterface for call state listener.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onCallStateChanged](#onCallStateChanged(kotlin.Int))`(`state:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Callback invoked when device call state changes. |\n\nPublic methods\n--------------\n\n### onCallStateChanged\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onCallStateChanged(state: Int): Unit\n```\n\nCallback invoked when device call state changes.\n\nReports the state of Telephony (mobile) calls on the device for the registered subscription.\n\nNote: the registration subscription ID comes from [TelephonyManager](/reference/kotlin/android/telephony/TelephonyManager) object which registers TelephonyCallback by [TelephonyManager.registerTelephonyCallback(Executor, TelephonyCallback)](/reference/kotlin/android/telephony/TelephonyManager#registerTelephonyCallback(java.util.concurrent.Executor,%20android.telephony.TelephonyCallback)). If this TelephonyManager object was created with [TelephonyManager.createForSubscriptionId(int)](/reference/kotlin/android/telephony/TelephonyManager#createForSubscriptionId(kotlin.Int)), then the callback applies to the subscription ID. Otherwise, this callback applies to [SubscriptionManager.getDefaultSubscriptionId()](/reference/kotlin/android/telephony/SubscriptionManager#getDefaultSubscriptionId()).\n\nNote: The state returned here may differ from that returned by [TelephonyManager.getCallState()](/reference/kotlin/android/telephony/TelephonyManager#getCallState()). Receivers of this callback should be aware that calling [TelephonyManager.getCallState()](/reference/kotlin/android/telephony/TelephonyManager#getCallState()) from within this callback may return a different state than the callback reports. \nRequires [android.Manifest.permission#READ_PHONE_STATE](../Manifest.permission.html#READ_PHONE_STATE:kotlin.String)\n\n| Parameters ||\n|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `state` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the current call state Value is [android.telephony.TelephonyManager#CALL_STATE_IDLE](/reference/kotlin/android/telephony/TelephonyManager#CALL_STATE_IDLE:kotlin.Int), [android.telephony.TelephonyManager#CALL_STATE_RINGING](/reference/kotlin/android/telephony/TelephonyManager#CALL_STATE_RINGING:kotlin.Int), or [android.telephony.TelephonyManager#CALL_STATE_OFFHOOK](/reference/kotlin/android/telephony/TelephonyManager#CALL_STATE_OFFHOOK:kotlin.Int) |"]]