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/net/TetheringManager#nestedclasses) \| [Constants](https://developer.android.com/reference/android/net/TetheringManager#constants) \| [Methods](https://developer.android.com/reference/android/net/TetheringManager#pubmethods) \| [Protected Methods](https://developer.android.com/reference/android/net/TetheringManager#promethods) \| [Inherited Methods](https://developer.android.com/reference/android/net/TetheringManager#inhmethods)

# TetheringManager

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/net/TetheringManager "View this page in Kotlin") \|Java


`
public


class
TetheringManager
`


`

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


`

`


`

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

<br />

*** ** * ** ***

This class provides the APIs to control the tethering service.

The primary responsibilities of this class are to provide the APIs for applications to
start tethering, stop tethering, query configuration and query status.

## Summary

| ### Nested classes ||
|---|---|
| ` interface` | `https://developer.android.com/reference/android/net/TetheringManager.StartTetheringCallback` Callback for use with `https://developer.android.com/reference/android/net/TetheringManager#startTethering(android.net.TetheringManager.TetheringRequest,%20java.util.concurrent.Executor,%20android.net.TetheringManager.StartTetheringCallback)` to find out whether tethering succeeded. |
| ` interface` | `https://developer.android.com/reference/android/net/TetheringManager.StopTetheringCallback` Callback for use with `https://developer.android.com/reference/android/net/TetheringManager#stopTethering(android.net.TetheringManager.TetheringRequest,%20java.util.concurrent.Executor,%20android.net.TetheringManager.StopTetheringCallback)` to find out whether stop tethering succeeded. |
| ` interface` | `https://developer.android.com/reference/android/net/TetheringManager.TetheringEventCallback` Callback for use with `https://developer.android.com/` to find out tethering upstream status. |
| ` class` | `https://developer.android.com/reference/android/net/TetheringManager.TetheringRequest` Use with `https://developer.android.com/reference/android/net/TetheringManager#startTethering(android.net.TetheringManager.TetheringRequest,%20java.util.concurrent.Executor,%20android.net.TetheringManager.StartTetheringCallback)` to specify additional parameters when starting tethering. |

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/net/TetheringManager#CONNECTIVITY_SCOPE_GLOBAL` Indicates that this tethering connection will provide connectivity beyond this device (e.g., global Internet access). |
| `int` | `https://developer.android.com/reference/android/net/TetheringManager#TETHERING_WIFI` Wifi tethering type. |
| `int` | `https://developer.android.com/reference/android/net/TetheringManager#TETHER_ERROR_DHCPSERVER_ERROR` |
| `int` | `https://developer.android.com/reference/android/net/TetheringManager#TETHER_ERROR_DISABLE_FORWARDING_ERROR` |
| `int` | `https://developer.android.com/reference/android/net/TetheringManager#TETHER_ERROR_DUPLICATE_REQUEST` |
| `int` | `https://developer.android.com/reference/android/net/TetheringManager#TETHER_ERROR_ENABLE_FORWARDING_ERROR` |
| `int` | `https://developer.android.com/reference/android/net/TetheringManager#TETHER_ERROR_ENTITLEMENT_UNKNOWN` |
| `int` | `https://developer.android.com/reference/android/net/TetheringManager#TETHER_ERROR_IFACE_CFG_ERROR` |
| `int` | `https://developer.android.com/reference/android/net/TetheringManager#TETHER_ERROR_INTERNAL_ERROR` |
| `int` | `https://developer.android.com/reference/android/net/TetheringManager#TETHER_ERROR_NO_ACCESS_TETHERING_PERMISSION` |
| `int` | `https://developer.android.com/reference/android/net/TetheringManager#TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION` |
| `int` | `https://developer.android.com/reference/android/net/TetheringManager#TETHER_ERROR_NO_ERROR` |
| `int` | `https://developer.android.com/reference/android/net/TetheringManager#TETHER_ERROR_PROVISIONING_FAILED` |
| `int` | `https://developer.android.com/reference/android/net/TetheringManager#TETHER_ERROR_SERVICE_UNAVAIL` |
| `int` | `https://developer.android.com/reference/android/net/TetheringManager#TETHER_ERROR_TETHER_IFACE_ERROR` |
| `int` | `https://developer.android.com/reference/android/net/TetheringManager#TETHER_ERROR_UNAVAIL_IFACE` |
| `int` | `https://developer.android.com/reference/android/net/TetheringManager#TETHER_ERROR_UNKNOWN_IFACE` |
| `int` | `https://developer.android.com/reference/android/net/TetheringManager#TETHER_ERROR_UNKNOWN_REQUEST` |
| `int` | `https://developer.android.com/reference/android/net/TetheringManager#TETHER_ERROR_UNKNOWN_TYPE` |
| `int` | `https://developer.android.com/reference/android/net/TetheringManager#TETHER_ERROR_UNSUPPORTED` |
| `int` | `https://developer.android.com/reference/android/net/TetheringManager#TETHER_ERROR_UNTETHER_IFACE_ERROR` |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/net/TetheringManager#registerTetheringEventCallback(java.util.concurrent.Executor,%20android.net.TetheringManager.TetheringEventCallback)(https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/net/TetheringManager.TetheringEventCallback callback) ` Start listening to tethering change events. |
| ` void` | ` https://developer.android.com/reference/android/net/TetheringManager#startTethering(android.net.TetheringManager.TetheringRequest,%20java.util.concurrent.Executor,%20android.net.TetheringManager.StartTetheringCallback)(https://developer.android.com/reference/android/net/TetheringManager.TetheringRequest request, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/net/TetheringManager.StartTetheringCallback callback) ` Starts tethering and runs tether provisioning for the given type if needed. |
| ` void` | ` https://developer.android.com/reference/android/net/TetheringManager#stopTethering(android.net.TetheringManager.TetheringRequest,%20java.util.concurrent.Executor,%20android.net.TetheringManager.StopTetheringCallback)(https://developer.android.com/reference/android/net/TetheringManager.TetheringRequest request, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/net/TetheringManager.StopTetheringCallback callback) ` Stops tethering for the given request. |
| ` void` | ` https://developer.android.com/reference/android/net/TetheringManager#unregisterTetheringEventCallback(android.net.TetheringManager.TetheringEventCallback)(https://developer.android.com/reference/android/net/TetheringManager.TetheringEventCallback callback) ` Remove tethering event callback previously registered with `https://developer.android.com/reference/android/net/TetheringManager#registerTetheringEventCallback(java.util.concurrent.Executor,%20android.net.TetheringManager.TetheringEventCallback)`. |

| ### Protected methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/net/TetheringManager#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. |

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

### CONNECTIVITY_SCOPE_GLOBAL

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

```
public static final int CONNECTIVITY_SCOPE_GLOBAL
```

Indicates that this tethering connection will provide connectivity beyond this device (e.g.,
global Internet access).

<br />

Constant Value:

1
(0x00000001)


### TETHERING_WIFI

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

```
public static final int TETHERING_WIFI
```

Wifi tethering type.

<br />

**See also:**

- `https://developer.android.com/reference/android/net/TetheringManager#startTethering(android.net.TetheringManager.TetheringRequest,%20java.util.concurrent.Executor,%20android.net.TetheringManager.StartTetheringCallback)`

Constant Value:

0
(0x00000000)


### TETHER_ERROR_DHCPSERVER_ERROR

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

```
public static final int TETHER_ERROR_DHCPSERVER_ERROR
```

<br />

<br />

Constant Value:

12
(0x0000000c)


### TETHER_ERROR_DISABLE_FORWARDING_ERROR

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

```
public static final int TETHER_ERROR_DISABLE_FORWARDING_ERROR
```

<br />

<br />

Constant Value:

9
(0x00000009)


### TETHER_ERROR_DUPLICATE_REQUEST

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

```
public static final int TETHER_ERROR_DUPLICATE_REQUEST
```

<br />

<br />

Constant Value:

18
(0x00000012)


### TETHER_ERROR_ENABLE_FORWARDING_ERROR

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

```
public static final int TETHER_ERROR_ENABLE_FORWARDING_ERROR
```

<br />

<br />

Constant Value:

8
(0x00000008)


### TETHER_ERROR_ENTITLEMENT_UNKNOWN

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

```
public static final int TETHER_ERROR_ENTITLEMENT_UNKNOWN
```

<br />

<br />

Constant Value:

13
(0x0000000d)


### TETHER_ERROR_IFACE_CFG_ERROR

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

```
public static final int TETHER_ERROR_IFACE_CFG_ERROR
```

<br />

<br />

Constant Value:

10
(0x0000000a)


### TETHER_ERROR_INTERNAL_ERROR

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

```
public static final int TETHER_ERROR_INTERNAL_ERROR
```

<br />

<br />

Constant Value:

5
(0x00000005)


### TETHER_ERROR_NO_ACCESS_TETHERING_PERMISSION

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

```
public static final int TETHER_ERROR_NO_ACCESS_TETHERING_PERMISSION
```

<br />

<br />

Constant Value:

15
(0x0000000f)


### TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION

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

```
public static final int TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION
```

<br />

<br />

Constant Value:

14
(0x0000000e)


### TETHER_ERROR_NO_ERROR

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

```
public static final int TETHER_ERROR_NO_ERROR
```

<br />

<br />

Constant Value:

0
(0x00000000)


### TETHER_ERROR_PROVISIONING_FAILED

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

```
public static final int TETHER_ERROR_PROVISIONING_FAILED
```

<br />

<br />

Constant Value:

11
(0x0000000b)


### TETHER_ERROR_SERVICE_UNAVAIL

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

```
public static final int TETHER_ERROR_SERVICE_UNAVAIL
```

<br />

<br />

Constant Value:

2
(0x00000002)


### TETHER_ERROR_TETHER_IFACE_ERROR

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

```
public static final int TETHER_ERROR_TETHER_IFACE_ERROR
```

<br />

<br />

Constant Value:

6
(0x00000006)


### TETHER_ERROR_UNAVAIL_IFACE

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

```
public static final int TETHER_ERROR_UNAVAIL_IFACE
```

<br />

<br />

Constant Value:

4
(0x00000004)


### TETHER_ERROR_UNKNOWN_IFACE

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

```
public static final int TETHER_ERROR_UNKNOWN_IFACE
```

<br />

<br />

Constant Value:

1
(0x00000001)


### TETHER_ERROR_UNKNOWN_REQUEST

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

```
public static final int TETHER_ERROR_UNKNOWN_REQUEST
```

<br />

<br />

Constant Value:

17
(0x00000011)


### TETHER_ERROR_UNKNOWN_TYPE

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

```
public static final int TETHER_ERROR_UNKNOWN_TYPE
```

<br />

<br />

Constant Value:

16
(0x00000010)


### TETHER_ERROR_UNSUPPORTED

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

```
public static final int TETHER_ERROR_UNSUPPORTED
```

<br />

<br />

Constant Value:

3
(0x00000003)


### TETHER_ERROR_UNTETHER_IFACE_ERROR

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

```
public static final int TETHER_ERROR_UNTETHER_IFACE_ERROR
```

<br />

<br />

Constant Value:

7
(0x00000007)


## Public methods

### registerTetheringEventCallback

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

```
public void registerTetheringEventCallback (Executor executor, 
                TetheringManager.TetheringEventCallback callback)
```

Start listening to tethering change events. Any new added callback will receive the last
tethering status right away. If callback is registered,
`https://developer.android.com/` will immediately be called. If tethering
has no upstream or disabled, the argument of callback will be null. The same callback object
cannot be registered twice.


Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_NETWORK_STATE`

<br />

| Parameters ||
|---|---|
| `executor` | `Executor`: the executor on which callback will be invoked. This value cannot be `null`. <br /> |
| `callback` | `TetheringManager.TetheringEventCallback`: the callback to be called when tethering has change events. This value cannot be `null`. <br /> |

### startTethering

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

```
public void startTethering (TetheringManager.TetheringRequest request, 
                Executor executor, 
                TetheringManager.StartTetheringCallback callback)
```

Starts tethering and runs tether provisioning for the given type if needed. If provisioning
fails, stopTethering will be called automatically.

<br />

| Parameters ||
|---|---|
| `request` | `TetheringManager.TetheringRequest`: a `https://developer.android.com/reference/android/net/TetheringManager.TetheringRequest` which can specify the preferred configuration. This value cannot be `null`. <br /> |
| `executor` | `Executor`: `https://developer.android.com/reference/java/util/concurrent/Executor` to specify the thread upon which the callback of TetheringRequest will be invoked. This value cannot be `null`. <br /> |
| `callback` | `TetheringManager.StartTetheringCallback`: A callback that will be called to indicate the success status of the tethering start request. This value cannot be `null`. <br /> |

### stopTethering

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

```
public void stopTethering (TetheringManager.TetheringRequest request, 
                Executor executor, 
                TetheringManager.StopTetheringCallback callback)
```

Stops tethering for the given request. Operation will fail with
`https://developer.android.com/reference/android/net/TetheringManager#TETHER_ERROR_UNKNOWN_REQUEST` if there is no request that matches it.

<br />

| Parameters ||
|---|---|
| `request` | `TetheringManager.TetheringRequest`: This value cannot be `null`. <br /> |
| `executor` | `Executor`: This value cannot be `null`. <br /> |
| `callback` | `TetheringManager.StopTetheringCallback`: This value cannot be `null`. <br /> |

### unregisterTetheringEventCallback

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

```
public void unregisterTetheringEventCallback (TetheringManager.TetheringEventCallback callback)
```

Remove tethering event callback previously registered with
`https://developer.android.com/reference/android/net/TetheringManager#registerTetheringEventCallback(java.util.concurrent.Executor,%20android.net.TetheringManager.TetheringEventCallback)`.


Requires `https://developer.android.com/` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_NETWORK_STATE`

<br />

| Parameters ||
|---|---|
| `callback` | `TetheringManager.TetheringEventCallback`: previously registered callback. This value cannot be `null`. <br /> |

## Protected methods

### finalize

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

```
protected void finalize ()
```

Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
A subclass overrides the `finalize` method to dispose of
system resources or to perform other cleanup.


The general contract of `finalize` is that it is invoked
if and when the Java virtual
machine has determined that there is no longer any
means by which this object can be accessed by any thread that has
not yet died, except as a result of an action taken by the
finalization of some other object or class which is ready to be
finalized. The `finalize` method may take any action, including
making this object available again to other threads; the usual purpose
of `finalize`, however, is to perform cleanup actions before
the object is irrevocably discarded. For example, the finalize method
for an object that represents an input/output connection might perform
explicit I/O transactions to break the connection before the object is
permanently discarded.


The `finalize` method of class `Object` performs no
special action; it simply returns normally. Subclasses of
`Object` may override this definition.


The Java programming language does not guarantee which thread will
invoke the `finalize` method for any given object. It is
guaranteed, however, that the thread that invokes finalize will not
be holding any user-visible synchronization locks when finalize is
invoked. If an uncaught exception is thrown by the finalize method,
the exception is ignored and finalization of that object terminates.


After the `finalize` method has been invoked for an object, no
further action is taken until the Java virtual machine has again
determined that there is no longer any means by which this object can
be accessed by any thread that has not yet died, including possible
actions by other objects or classes which are ready to be finalized,
at which point the object may be discarded.


The `finalize` method is never invoked more than once by a Java
virtual machine for any given object.


Any exception thrown by the `finalize` method causes
the finalization of this object to be halted, but is otherwise
ignored.

<br />

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/Throwable` |   |