# RangingResult

Artifact: [androidx.core.uwb:uwb](https://developer.android.com/jetpack/androidx/releases/core-uwb) [View Source](https://cs.android.com/search?q=file:androidx/core/uwb/RangingResult.kt+class:androidx.core.uwb.RangingResult) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core-uwb#1.0.0)

*** ** * ** ***


```
public sealed class RangingResult implements SensorFusionResult
```

<br />

Known direct subclasses [RangingResult.RangingResultFailure](https://developer.android.com/reference/androidx/core/uwb/RangingResult.RangingResultFailure), [RangingResult.RangingResultInitialized](https://developer.android.com/reference/androidx/core/uwb/RangingResult.RangingResultInitialized), [RangingResult.RangingResultPeerDisconnected](https://developer.android.com/reference/androidx/core/uwb/RangingResult.RangingResultPeerDisconnected), [RangingResult.RangingResultPosition](https://developer.android.com/reference/androidx/core/uwb/RangingResult.RangingResultPosition)

|---|---|
| `https://developer.android.com/reference/androidx/core/uwb/RangingResult.RangingResultFailure` | A ranging result indicating failure or suspension of a ranging session. |
| `https://developer.android.com/reference/androidx/core/uwb/RangingResult.RangingResultInitialized` | A ranging result when a ranging session is initialized with peer device. |
| `https://developer.android.com/reference/androidx/core/uwb/RangingResult.RangingResultPeerDisconnected` | A ranging result with peer disconnected status update. |
| `https://developer.android.com/reference/androidx/core/uwb/RangingResult.RangingResultPosition` | A ranging result with the device position update. |

*** ** * ** ***

Class for UWB ranging result update.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/core/uwb/RangingResult.RangingResultFailure extends https://developer.android.com/reference/androidx/core/uwb/RangingResult` A ranging result indicating failure or suspension of a ranging session. |
| `public final class https://developer.android.com/reference/androidx/core/uwb/RangingResult.RangingResultInitialized extends https://developer.android.com/reference/androidx/core/uwb/RangingResult` A ranging result when a ranging session is initialized with peer device. |
| `public final class https://developer.android.com/reference/androidx/core/uwb/RangingResult.RangingResultPeerDisconnected extends https://developer.android.com/reference/androidx/core/uwb/RangingResult` A ranging result with peer disconnected status update. |
| `public final class https://developer.android.com/reference/androidx/core/uwb/RangingResult.RangingResultPosition extends https://developer.android.com/reference/androidx/core/uwb/RangingResult` A ranging result with the device position update. |

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/core/uwb/RangingResult#RANGING_FAILURE_REASON_ARCORE_APK_INSTALL_NEEDED() = 7` Ranging stopped because the ARCore APK is either outdated or not installed. |
| `static final int` | `https://developer.android.com/reference/androidx/core/uwb/RangingResult#RANGING_FAILURE_REASON_BAD_PARAMETERS() = 1` Ranging failed due to bad or invalid parameters. |
| `static final int` | `https://developer.android.com/reference/androidx/core/uwb/RangingResult#RANGING_FAILURE_REASON_FAILED_TO_START() = 2` Generic failure to start the ranging session. |
| `static final int` | `https://developer.android.com/reference/androidx/core/uwb/RangingResult#RANGING_FAILURE_REASON_MAX_RR_RETRY_REACHED() = 6` Ranging stopped because the maximum number of ranging round retries was reached. |
| `static final int` | `https://developer.android.com/reference/androidx/core/uwb/RangingResult#RANGING_FAILURE_REASON_STOPPED_BY_LOCAL() = 4` The ranging session was stopped by a local request. |
| `static final int` | `https://developer.android.com/reference/androidx/core/uwb/RangingResult#RANGING_FAILURE_REASON_STOPPED_BY_PEER() = 3` The ranging session was stopped by the peer device. |
| `static final int` | `https://developer.android.com/reference/androidx/core/uwb/RangingResult#RANGING_FAILURE_REASON_SYSTEM_POLICY() = 5` Ranging stopped or failed due to system policy. |
| `static final int` | `https://developer.android.com/reference/androidx/core/uwb/RangingResult#RANGING_FAILURE_REASON_UNKNOWN() = 0` Unknown failure reason. |

| ### Protected constructors |
|---|
| `https://developer.android.com/reference/androidx/core/uwb/RangingResult#RangingResult()()` |

| ### Public methods |
|---|---|
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/uwb/UwbDevice` | `https://developer.android.com/reference/androidx/core/uwb/RangingResult#getDevice()()` The peer UWB device that this result applies to. |

## Constants

### RANGING_FAILURE_REASON_ARCORE_APK_INSTALL_NEEDED

```
public static final int RANGING_FAILURE_REASON_ARCORE_APK_INSTALL_NEEDED = 7
```

Ranging stopped because the ARCore APK is either outdated or not installed. This will only happen for sensor fusion sessions.

To use sensor fusion, you must first verify that ARCore is installed and up to date. Please follow documentation to [enable AR in your Android app](https://developers.google.com/ar/develop/java/enable-arcore).

### RANGING_FAILURE_REASON_BAD_PARAMETERS

```
public static final int RANGING_FAILURE_REASON_BAD_PARAMETERS = 1
```

Ranging failed due to bad or invalid parameters.

### RANGING_FAILURE_REASON_FAILED_TO_START

```
public static final int RANGING_FAILURE_REASON_FAILED_TO_START = 2
```

Generic failure to start the ranging session.

### RANGING_FAILURE_REASON_MAX_RR_RETRY_REACHED

```
public static final int RANGING_FAILURE_REASON_MAX_RR_RETRY_REACHED = 6
```

Ranging stopped because the maximum number of ranging round retries was reached.

### RANGING_FAILURE_REASON_STOPPED_BY_LOCAL

```
public static final int RANGING_FAILURE_REASON_STOPPED_BY_LOCAL = 4
```

The ranging session was stopped by a local request.

### RANGING_FAILURE_REASON_STOPPED_BY_PEER

```
public static final int RANGING_FAILURE_REASON_STOPPED_BY_PEER = 3
```

The ranging session was stopped by the peer device.

### RANGING_FAILURE_REASON_SYSTEM_POLICY

```
public static final int RANGING_FAILURE_REASON_SYSTEM_POLICY = 5
```

Ranging stopped or failed due to system policy.

### RANGING_FAILURE_REASON_UNKNOWN

```
public static final int RANGING_FAILURE_REASON_UNKNOWN = 0
```

Unknown failure reason.

## Protected constructors

### RangingResult

```
protected RangingResult()
```

## Public methods

### getDevice

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core-uwb#1.0.0)

```
public abstract @NonNull UwbDevice getDevice()
```

The peer UWB device that this result applies to.