Stay organized with collections
Save and categorize content based on your preferences.
OnSubscriptionsChangedListener
open class OnSubscriptionsChangedListener
A listener class for monitoring changes to SubscriptionInfo
records.
Override the onSubscriptionsChanged method in the object that extends this class and pass it to addOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener)
to register your listener and to unregister invoke removeOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener)
Permissions android.Manifest.permission.READ_PHONE_STATE is required for #onSubscriptionsChanged to be invoked.
Summary
Public constructors |
Create an OnSubscriptionsChangedListener.
|
Public methods |
open Unit |
Callback invoked when there is any change to any SubscriptionInfo, as well as once on registering for changes with #addOnSubscriptionsChangedListener.
|
Public constructors
Public methods
onSubscriptionsChanged
open fun onSubscriptionsChanged(): Unit
Callback invoked when there is any change to any SubscriptionInfo, as well as once on registering for changes with #addOnSubscriptionsChangedListener. Typically this method would invoke getActiveSubscriptionInfoList
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,["# SubscriptionManager.OnSubscriptionsChangedListener\n\nAdded in [API level 22](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nOnSubscriptionsChangedListener\n==============================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/telephony/SubscriptionManager.OnSubscriptionsChangedListener \"View this page in Java\") \n\n```\nopen class OnSubscriptionsChangedListener\n```\n\n|---|---------------------------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.telephony.SubscriptionManager.OnSubscriptionsChangedListener](#) |\n\nA listener class for monitoring changes to [SubscriptionInfo](/reference/kotlin/android/telephony/SubscriptionInfo) records.\n\nOverride the onSubscriptionsChanged method in the object that extends this class and pass it to [addOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener)](/reference/kotlin/android/telephony/SubscriptionManager#addOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener)) to register your listener and to unregister invoke [removeOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener)](/reference/kotlin/android/telephony/SubscriptionManager#removeOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener))\n\nPermissions android.Manifest.permission.READ_PHONE_STATE is required for #onSubscriptionsChanged to be invoked.\n\nSummary\n-------\n\n| Public constructors ||\n|-------------------------------------------------------------------------------------------------------------------|---|\n| [OnSubscriptionsChangedListener](#OnSubscriptionsChangedListener())`()` Create an OnSubscriptionsChangedListener. |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onSubscriptionsChanged](#onSubscriptionsChanged())`()` Callback invoked when there is any change to any SubscriptionInfo, as well as once on registering for changes with #addOnSubscriptionsChangedListener. |\n\nPublic constructors\n-------------------\n\n### OnSubscriptionsChangedListener\n\nAdded in [API level 22](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nOnSubscriptionsChangedListener()\n```\n\nCreate an OnSubscriptionsChangedListener. For callers targeting [Build.VERSION_CODES.P](../os/Build.VERSION_CODES.html#P:kotlin.Int) or earlier, this can only be called on a thread that already has a prepared Looper. Callers targeting Q or later should subsequently use [SubscriptionManager.addOnSubscriptionsChangedListener(](/reference/kotlin/android/telephony/SubscriptionManager#addOnSubscriptionsChangedListener(java.util.concurrent.Executor,%20android.telephony.SubscriptionManager.OnSubscriptionsChangedListener)). On OS versions prior to [Build.VERSION_CODES.VANILLA_ICE_CREAM](../os/Build.VERSION_CODES.html#VANILLA_ICE_CREAM:kotlin.Int) callers should assume that this call will fail if invoked on a thread that does not already have a prepared looper.\n\nPublic methods\n--------------\n\n### onSubscriptionsChanged\n\nAdded in [API level 22](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onSubscriptionsChanged(): Unit\n```\n\nCallback invoked when there is any change to any SubscriptionInfo, as well as once on registering for changes with #addOnSubscriptionsChangedListener. Typically this method would invoke [getActiveSubscriptionInfoList](/reference/kotlin/android/telephony/SubscriptionManager#getActiveSubscriptionInfoList())"]]