Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/ranging/RangingManager#nestedclasses) \| [Constants](https://developer.android.com/reference/android/ranging/RangingManager#constants) \| [Methods](https://developer.android.com/reference/android/ranging/RangingManager#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/ranging/RangingManager#inhmethods)

# RangingManager

*** ** * ** ***


`
public

final

class
RangingManager
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.ranging.RangingManager |

<br />

*** ** * ** ***

This class provides a way to perform ranging operations such as querying the
device's capabilities and determining the distance and angle between the local device and a
remote device.

To get a `https://developer.android.com/reference/android/ranging/RangingManager`, call the
`Context.getSystemService(RangingManager.class)`.


Restricted for SDK Runtime environment in API level 36.

## Summary

| ### Nested classes ||
|---|---|
| ` interface` | `https://developer.android.com/reference/android/ranging/RangingManager.RangingCapabilitiesCallback` Callback interface to receive the availabilities and capabilities of all the ranging technology supported by the device. |

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/ranging/RangingManager#BLE_CS` Bluetooth Channel Sounding (BT-CS) technology. |
| `int` | `https://developer.android.com/reference/android/ranging/RangingManager#BLE_RSSI` Bluetooth Low Energy (BLE) RSSI-based ranging technology. |
| `int` | `https://developer.android.com/reference/android/ranging/RangingManager#UWB` Ultra-Wideband (UWB) technology. |
| `int` | `https://developer.android.com/reference/android/ranging/RangingManager#WIFI_NAN_RTT` WiFi Round Trip Time (WiFi-NAN-RTT 802.11mc) technology. |
| `int` | `https://developer.android.com/reference/android/ranging/RangingManager#WIFI_PD` WiFi Alliance Wi-Fi Proximity Detection (Wi-Fi PD) technology. |
| `int` | `https://developer.android.com/reference/android/ranging/RangingManager#WIFI_STA_RTT` WiFi Round Trip Time (WiFi-STA-AP-RTT 8011.mc) technology. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/ranging/RangingSession` | ` https://developer.android.com/reference/android/ranging/RangingManager#createRangingSession(java.util.concurrent.Executor,%20android.ranging.RangingSession.Callback)(https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/ranging/RangingSession.Callback callback) ` Creates a new ranging session. |
| ` void` | ` https://developer.android.com/reference/android/ranging/RangingManager#registerCapabilitiesCallback(java.util.concurrent.Executor,%20android.ranging.RangingManager.RangingCapabilitiesCallback)(https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/ranging/RangingManager.RangingCapabilitiesCallback callback) ` Registers a callback to receive ranging capabilities updates. |
| ` void` | ` https://developer.android.com/reference/android/ranging/RangingManager#unregisterCapabilitiesCallback(android.ranging.RangingManager.RangingCapabilitiesCallback)(https://developer.android.com/reference/android/ranging/RangingManager.RangingCapabilitiesCallback callback) ` Unregisters a previously registered ranging capabilities callback. |

| ### 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

### BLE_CS

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

```
public static final int BLE_CS
```

Bluetooth Channel Sounding (BT-CS) technology.

<br />

Constant Value:

1
(0x00000001)


### BLE_RSSI

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

```
public static final int BLE_RSSI
```

Bluetooth Low Energy (BLE) RSSI-based ranging technology.

<br />

Constant Value:

3
(0x00000003)


### UWB

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

```
public static final int UWB
```

Ultra-Wideband (UWB) technology.

<br />

Constant Value:

0
(0x00000000)


### WIFI_NAN_RTT

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

```
public static final int WIFI_NAN_RTT
```

WiFi Round Trip Time (WiFi-NAN-RTT 802.11mc) technology.

<br />

Constant Value:

2
(0x00000002)


### WIFI_PD

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

```
public static final int WIFI_PD
```

WiFi Alliance Wi-Fi Proximity Detection (Wi-Fi PD) technology.

<br />

Constant Value:

5
(0x00000005)


### WIFI_STA_RTT

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static final int WIFI_STA_RTT
```

WiFi Round Trip Time (WiFi-STA-AP-RTT 8011.mc) technology.

<br />

Constant Value:

4
(0x00000004)


## Public methods

### createRangingSession

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

```
public RangingSession createRangingSession (Executor executor, 
                RangingSession.Callback callback)
```

Creates a new ranging session. A ranging session enables the application
to perform ranging operations using available technologies such as
UWB (Ultra-Wideband) or WiFi RTT (Round Trip Time).

This method returns a `https://developer.android.com/reference/android/ranging/RangingSession` instance, which can be
used to initiate, manage, and stop ranging operations. The provided
`https://developer.android.com/reference/android/ranging/RangingSession.Callback` will be used to receive session-related
events, such as session start, stop, and ranging updates.

It is recommended to provide an appropriate `https://developer.android.com/reference/java/util/concurrent/Executor` to ensure
that callback events are handled on a suitable thread.

<br />

| Parameters ||
|---|---|
| `executor` | `Executor`: the `https://developer.android.com/reference/java/util/concurrent/Executor` on which the callback will be invoked. Must not be `null`. <br /> |
| `callback` | `RangingSession.Callback`: the `https://developer.android.com/reference/android/ranging/RangingSession.Callback` to handle session-related events. Must not be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/ranging/RangingSession` | the `https://developer.android.com/reference/android/ranging/RangingSession` instance if the session was successfully created, or `null` if the session could not be created. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | if `callback` or `executor` is null. |
| `https://developer.android.com/reference/java/lang/SecurityException` | if the calling app does not have the necessary permissions to create a ranging session. |

### registerCapabilitiesCallback

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

```
public void registerCapabilitiesCallback (Executor executor, 
                RangingManager.RangingCapabilitiesCallback callback)
```

Registers a callback to receive ranging capabilities updates.

<br />

| Parameters ||
|---|---|
| `executor` | `Executor`: The `https://developer.android.com/reference/java/util/concurrent/Executor` on which the callback will be executed. Must not be null. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `callback` | `RangingManager.RangingCapabilitiesCallback`: The `https://developer.android.com/reference/android/ranging/RangingManager.RangingCapabilitiesCallback` that will handle the capabilities updates. Must not be null. <br /> |

| Returns ||
|---|---|
| `void` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | if the `executor` or `callback` is null. |

### unregisterCapabilitiesCallback

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

```
public void unregisterCapabilitiesCallback (RangingManager.RangingCapabilitiesCallback callback)
```

Unregisters a previously registered ranging capabilities callback.

<br />

| Parameters ||
|---|---|
| `callback` | `RangingManager.RangingCapabilitiesCallback`: The `https://developer.android.com/reference/android/ranging/RangingManager.RangingCapabilitiesCallback` to be unregistered. Must not be null. <br /> |

| Returns ||
|---|---|
| `void` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | if the `callback` is null. |