Added in API level 22

OnSubscriptionsChangedListener


open class OnSubscriptionsChangedListener
kotlin.Any
   ↳ android.telephony.SubscriptionManager.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

OnSubscriptionsChangedListener

Added in API level 22
OnSubscriptionsChangedListener()

Create an OnSubscriptionsChangedListener. For callers targeting Build.VERSION_CODES#P 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(. On OS versions prior to Build.VERSION_CODES#VANILLA_ICE_CREAM callers should assume that this call will fail if invoked on a thread that does not already have a prepared looper.

Public methods

onSubscriptionsChanged

Added in API level 22
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