Stay organized with collections
Save and categorize content based on your preferences.
CarrierNetworkListener
interface CarrierNetworkListener
Interface for carrier network listener.
Summary
Public methods
onCarrierNetworkChange
abstract fun onCarrierNetworkChange(active: Boolean): Unit
Callback invoked when telephony has received notice from a carrier app that a network action that could result in connectivity loss has been requested by an app using android.service.carrier.CarrierService#notifyCarrierNetworkChange(boolean)
This is optional and is only used to allow the system to provide alternative UI while telephony is performing an action that may result in intentional, temporary network lack of connectivity.
Note, this callback is pinned to the registered subscription and will be invoked when the notifying carrier app has carrier privilege rule on the registered subscription. android.telephony.TelephonyManager#hasCarrierPrivileges
Parameters |
active |
Boolean: If the carrier network change is or shortly will be active, true indicate that showing alternative UI, false otherwise. |
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.CarrierNetworkListener\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nCarrierNetworkListener\n======================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/telephony/TelephonyCallback.CarrierNetworkListener \"View this page in Java\") \n\n```\ninterface CarrierNetworkListener\n```\n\n|-----------------------------------------------------------------|\n| [android.telephony.TelephonyCallback.CarrierNetworkListener](#) |\n\nInterface for carrier network listener.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onCarrierNetworkChange](#onCarrierNetworkChange(kotlin.Boolean))`(`active:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Callback invoked when telephony has received notice from a carrier app that a network action that could result in connectivity loss has been requested by an app using [android.service.carrier.CarrierService#notifyCarrierNetworkChange(boolean)](../service/carrier/CarrierService.html#notifyCarrierNetworkChange(kotlin.Boolean)) |\n\nPublic methods\n--------------\n\n### onCarrierNetworkChange\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onCarrierNetworkChange(active: Boolean): Unit\n```\n\nCallback invoked when telephony has received notice from a carrier app that a network action that could result in connectivity loss has been requested by an app using [android.service.carrier.CarrierService#notifyCarrierNetworkChange(boolean)](../service/carrier/CarrierService.html#notifyCarrierNetworkChange(kotlin.Boolean))\n\nThis is optional and is only used to allow the system to provide alternative UI while telephony is performing an action that may result in intentional, temporary network lack of connectivity.\n\nNote, this callback is pinned to the registered subscription and will be invoked when the notifying carrier app has carrier privilege rule on the registered subscription. [android.telephony.TelephonyManager#hasCarrierPrivileges](/reference/kotlin/android/telephony/TelephonyManager#hasCarrierPrivileges())\n\n| Parameters ||\n|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `active` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): If the carrier network change is or shortly will be active, `true` indicate that showing alternative UI, `false` otherwise. |"]]