Added in API level 28

RangingResultCallback


abstract class RangingResultCallback
kotlin.Any
   ↳ android.net.wifi.rtt.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 constructors

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

Added in API level 28
static val STATUS_CODE_FAIL: Int

A failure code for the whole ranging request operation. Indicates a failure.

Value: 1

STATUS_CODE_FAIL_RTT_NOT_AVAILABLE

Added in API level 28
static val STATUS_CODE_FAIL_RTT_NOT_AVAILABLE: Int

A 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() and WifiRttManager#ACTION_WIFI_RTT_STATE_CHANGED to track RTT availability.

Value: 2

Public constructors

RangingResultCallback

Added in API level 28
RangingResultCallback()

Public methods

onRangingFailure

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

Parameters
code Int: A status code indicating the type of failure. Value is android.net.wifi.rtt.RangingResultCallback#STATUS_CODE_FAIL, or android.net.wifi.rtt.RangingResultCallback#STATUS_CODE_FAIL_RTT_NOT_AVAILABLE

onRangingResults

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