Stay organized with collections
Save and categorize content based on your preferences.
NetworkScanCallback
abstract class NetworkScanCallback
The caller of android.telephony.TelephonyManager#requestNetworkScan(android.telephony.NetworkScanRequest,java.util.concurrent.Executor,android.telephony.TelephonyScanManager.NetworkScanCallback)
should implement and provide this callback so that the scan results or errors can be returned.
Summary
Public methods |
open Unit |
Informs the user that the scan has stopped.
|
open Unit |
Informs the user that there is some error about the scan.
|
open Unit |
Returns the scan results to the user, this callback will be called multiple times.
|
Public constructors
NetworkScanCallback
NetworkScanCallback()
Public methods
onComplete
open fun onComplete(): Unit
Informs the user that the scan has stopped. This callback will be called when the scan is finished or cancelled by the user. The related NetworkScanRequest will be deleted after this callback.
onError
open fun onError(error: Int): Unit
Informs the user that there is some error about the scan. This callback will be called whenever there is any error about the scan, and the scan will be terminated. onComplete() will NOT be called.
onResults
open fun onResults(results: MutableList<CellInfo!>!): Unit
Returns the scan results to the user, this callback will be called multiple times.
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,["# TelephonyScanManager.NetworkScanCallback\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nNetworkScanCallback\n===================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/telephony/TelephonyScanManager.NetworkScanCallback \"View this page in Java\") \n\n```\nabstract class NetworkScanCallback\n```\n\n|---|-----------------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.telephony.TelephonyScanManager.NetworkScanCallback](#) |\n\nThe caller of [android.telephony.TelephonyManager#requestNetworkScan(android.telephony.NetworkScanRequest,java.util.concurrent.Executor,android.telephony.TelephonyScanManager.NetworkScanCallback)](/reference/kotlin/android/telephony/TelephonyManager#requestNetworkScan(android.telephony.NetworkScanRequest,%20java.util.concurrent.Executor,%20android.telephony.TelephonyScanManager.NetworkScanCallback)) should implement and provide this callback so that the scan results or errors can be returned.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------------------------------|---|\n| [NetworkScanCallback](#NetworkScanCallback())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onComplete](#onComplete())`()` Informs the user that the scan has stopped. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onError](#onError(kotlin.Int))`(`error:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Informs the user that there is some error about the scan. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onResults](#onResults(kotlin.collections.MutableList))`(`results:` `[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\u003c[CellInfo](/reference/kotlin/android/telephony/CellInfo)!\u003e!`)` Returns the scan results to the user, this callback will be called multiple times. |\n\nPublic constructors\n-------------------\n\n### NetworkScanCallback\n\n```\nNetworkScanCallback()\n```\n\nPublic methods\n--------------\n\n### onComplete\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onComplete(): Unit\n```\n\nInforms the user that the scan has stopped. This callback will be called when the scan is finished or cancelled by the user. The related NetworkScanRequest will be deleted after this callback. \n\n### onError\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onError(error: Int): Unit\n```\n\nInforms the user that there is some error about the scan. This callback will be called whenever there is any error about the scan, and the scan will be terminated. onComplete() will NOT be called.\n\n| Parameters ||\n|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `error` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Error code when the scan is failed, as defined in [NetworkScan](/reference/kotlin/android/telephony/NetworkScan). Value is [android.telephony.NetworkScan#ERROR_MODEM_ERROR](/reference/kotlin/android/telephony/NetworkScan#ERROR_MODEM_ERROR:kotlin.Int), [android.telephony.NetworkScan#ERROR_INVALID_SCAN](/reference/kotlin/android/telephony/NetworkScan#ERROR_INVALID_SCAN:kotlin.Int), [android.telephony.NetworkScan#ERROR_MODEM_UNAVAILABLE](/reference/kotlin/android/telephony/NetworkScan#ERROR_MODEM_UNAVAILABLE:kotlin.Int), [android.telephony.NetworkScan#ERROR_UNSUPPORTED](/reference/kotlin/android/telephony/NetworkScan#ERROR_UNSUPPORTED:kotlin.Int), [android.telephony.NetworkScan#ERROR_RADIO_INTERFACE_ERROR](/reference/kotlin/android/telephony/NetworkScan#ERROR_RADIO_INTERFACE_ERROR:kotlin.Int), [android.telephony.NetworkScan#ERROR_INVALID_SCANID](/reference/kotlin/android/telephony/NetworkScan#ERROR_INVALID_SCANID:kotlin.Int), or [android.telephony.NetworkScan#ERROR_INTERRUPTED](/reference/kotlin/android/telephony/NetworkScan#ERROR_INTERRUPTED:kotlin.Int) |\n\n### onResults\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onResults(results: MutableList\u003cCellInfo!\u003e!): Unit\n```\n\nReturns the scan results to the user, this callback will be called multiple times."]]