Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/net/wifi/rtt/RangingResultCallback#constants) \| [Ctors](https://developer.android.com/reference/android/net/wifi/rtt/RangingResultCallback#pubctors) \| [Methods](https://developer.android.com/reference/android/net/wifi/rtt/RangingResultCallback#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/net/wifi/rtt/RangingResultCallback#inhmethods)

# RangingResultCallback

*** ** * ** ***

` public abstract class RangingResultCallback `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.net.wifi.rtt.RangingResultCallback |

<br />

*** ** * ** ***

Base class for ranging result callbacks. Should be extended by applications and set when calling `https://developer.android.com/reference/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 `https://developer.android.com/reference/android/net/wifi/rtt/RangingResultCallback#onRangingFailure(int)` will be called with a failure code. If the ranging operation is performed for each of the requested peers then the `https://developer.android.com/reference/android/net/wifi/rtt/RangingResultCallback#onRangingResults(java.util.List<android.net.wifi.rtt.RangingResult>)` will be called with the set of results (@link `https://developer.android.com/reference/android/net/wifi/rtt/RangingResult`, each of which has its own success/failure code `https://developer.android.com/reference/android/net/wifi/rtt/RangingResult#getStatus()`.

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/net/wifi/rtt/RangingResultCallback#STATUS_CODE_FAIL` A failure code for the whole ranging request operation. |
| `int` | `https://developer.android.com/reference/android/net/wifi/rtt/RangingResultCallback#STATUS_CODE_FAIL_RTT_NOT_AVAILABLE` A failure code for the whole ranging request operation. |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/net/wifi/rtt/RangingResultCallback#RangingResultCallback()() ` |

| ### Public methods ||
|---|---|
| ` abstract void` | ` https://developer.android.com/reference/android/net/wifi/rtt/RangingResultCallback#onRangingFailure(int)(int code) ` Called when a ranging operation failed in whole - i.e. |
| ` abstract void` | ` https://developer.android.com/reference/android/net/wifi/rtt/RangingResultCallback#onRangingResults(java.util.List<android.net.wifi.rtt.RangingResult>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/net/wifi/rtt/RangingResult> results) ` Called when a ranging operation was executed. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Constants

### STATUS_CODE_FAIL

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STATUS_CODE_FAIL
```

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

<br />

Constant Value: 1 (0x00000001)

### STATUS_CODE_FAIL_RTT_NOT_AVAILABLE

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STATUS_CODE_FAIL_RTT_NOT_AVAILABLE
```

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 `https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#isAvailable()` and `https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#ACTION_WIFI_RTT_STATE_CHANGED` to track RTT availability.

<br />

Constant Value: 2 (0x00000002)

## Public constructors

### RangingResultCallback

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public RangingResultCallback ()
```

<br />

<br />

## Public methods

### onRangingFailure

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void onRangingFailure (int code)
```

Called when a ranging operation failed in whole - i.e. no ranging operation to any of the devices specified in the request was attempted.

<br />

| Parameters ||
|---|---|
| `code` | `int`: A status code indicating the type of failure. Value is one of the following: - `https://developer.android.com/reference/android/net/wifi/rtt/RangingResultCallback#STATUS_CODE_FAIL` - `https://developer.android.com/reference/android/net/wifi/rtt/RangingResultCallback#STATUS_CODE_FAIL_RTT_NOT_AVAILABLE` |

### onRangingResults

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void onRangingResults (List<RangingResult> results)
```

Called when a ranging operation was executed. The list of results corresponds to devices specified in the ranging request.

<br />

| Parameters ||
|---|---|
| `results` | `List`: List of range measurements, one per requested device. This value cannot be `null`. <br /> |