Stay organized with collections
Save and categorize content based on your preferences.
RangingResultCallback
abstract class RangingResultCallback
Base class for ranging result callbacks. Should be extended by applications and set when calling WifiRttManager.startRanging(RangingRequest, java.util.concurrent.Executor, RangingResultCallback)
. If the ranging operation fails in whole (not attempted) then onRangingFailure(int)
will be called with a failure code. If the ranging operation is performed for each of the requested peers then the onRangingResults(java.util.List)
will be called with the set of results (@link RangingResult
, each of which has its own success/failure code RangingResult.getStatus()
.
Summary
Constants |
static Int |
A failure code for the whole ranging request operation.
|
static Int |
A failure code for the whole ranging request operation.
|
Public methods |
abstract Unit |
Called when a ranging operation failed in whole - i.
|
abstract Unit |
Called when a ranging operation was executed.
|
Constants
STATUS_CODE_FAIL
static val STATUS_CODE_FAIL: Int
A failure code for the whole ranging request operation. Indicates a failure.
Value: 1
Public constructors
RangingResultCallback
RangingResultCallback()
Public methods
onRangingFailure
abstract fun onRangingFailure(code: Int): Unit
Called when a ranging operation failed in whole - i.e. no ranging operation to any of the devices specified in the request was attempted.
onRangingResults
abstract fun onRangingResults(results: MutableList<RangingResult!>): Unit
Called when a ranging operation was executed. The list of results corresponds to devices specified in the ranging request.
Parameters |
results |
MutableList<RangingResult!>: List of range measurements, one per requested device. This value cannot be null . |
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,["# RangingResultCallback\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nRangingResultCallback\n=====================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/net/wifi/rtt/RangingResultCallback \"View this page in Java\") \n\n```\nabstract class RangingResultCallback\n```\n\n|---|-------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.net.wifi.rtt.RangingResultCallback](#) |\n\nBase class for ranging result callbacks. Should be extended by applications and set when calling [WifiRttManager.startRanging(RangingRequest, java.util.concurrent.Executor, RangingResultCallback)](/reference/kotlin/android/net/wifi/rtt/WifiRttManager#startRanging(android.net.wifi.rtt.RangingRequest,%20java.util.concurrent.Executor,%20android.net.wifi.rtt.RangingResultCallback)). If the ranging operation fails in whole (not attempted) then [onRangingFailure(int)](#onRangingFailure(kotlin.Int)) will be called with a failure code. If the ranging operation is performed for each of the requested peers then the [onRangingResults(java.util.List)](#onRangingResults(kotlin.collections.MutableList)) will be called with the set of results (@link [RangingResult](/reference/kotlin/android/net/wifi/rtt/RangingResult), each of which has its own success/failure code [RangingResult.getStatus()](/reference/kotlin/android/net/wifi/rtt/RangingResult#getStatus()).\n\nSummary\n-------\n\n| Constants ||\n|-----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [STATUS_CODE_FAIL](#STATUS_CODE_FAIL:kotlin.Int) A failure code for the whole ranging request operation. |\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [STATUS_CODE_FAIL_RTT_NOT_AVAILABLE](#STATUS_CODE_FAIL_RTT_NOT_AVAILABLE:kotlin.Int) A failure code for the whole ranging request operation. |\n\n| Public constructors ||\n|--------------------------------------------------------------|---|\n| [RangingResultCallback](#RangingResultCallback())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onRangingFailure](#onRangingFailure(kotlin.Int))`(`code:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Called when a ranging operation failed in whole - i. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onRangingResults](#onRangingResults(kotlin.collections.MutableList))`(`results:` `[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\u003c[RangingResult](/reference/kotlin/android/net/wifi/rtt/RangingResult)!\u003e`)` Called when a ranging operation was executed. |\n\nConstants\n---------\n\n### STATUS_CODE_FAIL\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val STATUS_CODE_FAIL: Int\n```\n\nA failure code for the whole ranging request operation. Indicates a failure. \n\n Value: 1\n\n### STATUS_CODE_FAIL_RTT_NOT_AVAILABLE\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val STATUS_CODE_FAIL_RTT_NOT_AVAILABLE: Int\n```\n\nA failure code for the whole ranging request operation. Indicates that the request failed due to RTT not being available - e.g. Wi-Fi was disabled. Use the [WifiRttManager.isAvailable()](/reference/kotlin/android/net/wifi/rtt/WifiRttManager#isAvailable()) and [WifiRttManager.ACTION_WIFI_RTT_STATE_CHANGED](/reference/kotlin/android/net/wifi/rtt/WifiRttManager#ACTION_WIFI_RTT_STATE_CHANGED:kotlin.String) to track RTT availability. \n\n Value: 2\n\nPublic constructors\n-------------------\n\n### RangingResultCallback\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nRangingResultCallback()\n```\n\nPublic methods\n--------------\n\n### onRangingFailure\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onRangingFailure(code: Int): Unit\n```\n\nCalled when a ranging operation failed in whole - i.e. no ranging operation to any of the devices specified in the request was attempted.\n\n| Parameters ||\n|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `code` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): A status code indicating the type of failure. Value is [android.net.wifi.rtt.RangingResultCallback#STATUS_CODE_FAIL](#STATUS_CODE_FAIL:kotlin.Int), or [android.net.wifi.rtt.RangingResultCallback#STATUS_CODE_FAIL_RTT_NOT_AVAILABLE](#STATUS_CODE_FAIL_RTT_NOT_AVAILABLE:kotlin.Int) |\n\n### onRangingResults\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onRangingResults(results: MutableList\u003cRangingResult!\u003e): Unit\n```\n\nCalled when a ranging operation was executed. The list of results corresponds to devices specified in the ranging request.\n\n| Parameters ||\n|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `results` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\\\u003c[RangingResult](/reference/kotlin/android/net/wifi/rtt/RangingResult)!\\\u003e: List of range measurements, one per requested device. This value cannot be `null`. |"]]