Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions) Summary: [Nested Classes](https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions#nestedclasses) \| [Constants](https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions#constants) \| [Methods](https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions#inhmethods)

# ConnectionMigrationOptions

*** ** * ** ***


`
public


class
ConnectionMigrationOptions
`


`

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


`

`


`

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

<br />

*** ** * ** ***

A class configuring the HTTP connection migration functionality.

Connection migration stops open connections to servers from being destroyed when the
client device switches its L4 connectivity (typically the IP address as a result of using
a different network). This is particularly common with mobile devices losing
wifi connectivity and switching to cellular data, or vice versa (a.k.a. the parking lot
problem). QUIC uses connection identifiers which are independent of the underlying
transport layer to make this possible. If the client connects to a new network and wants
to preserve the existing connection, they can do so by using a connection identifier the server
knows to be a continuation of the existing connection.

The features are only available for QUIC connections and the server needs to support
connection migration.
**See also:**

- [Connection
  Migration specification](https://www.rfc-editor.org/rfc/rfc9000.html#section-9)

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions.Builder` Builder for `https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions`. |

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions#MIGRATION_OPTION_DISABLED` Option is disabled. |
| `int` | `https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions#MIGRATION_OPTION_ENABLED` Option is enabled. |
| `int` | `https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions#MIGRATION_OPTION_UNSPECIFIED` Option is unspecified, platform default value will be used. |

| ### Public methods ||
|---|---|
| ` int` | ` https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions#getAllowNonDefaultNetworkUsage()() ` See `https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions.Builder#setAllowNonDefaultNetworkUsage(int)` |
| ` int` | ` https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions#getDefaultNetworkMigration()() ` See `https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions.Builder#setDefaultNetworkMigration(int)` |
| ` int` | ` https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions#getPathDegradationMigration()() ` See `https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions.Builder#setPathDegradationMigration(int)` |

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

### MIGRATION_OPTION_DISABLED

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public static final int MIGRATION_OPTION_DISABLED
```

Option is disabled.

<br />

Constant Value:

2
(0x00000002)


### MIGRATION_OPTION_ENABLED

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public static final int MIGRATION_OPTION_ENABLED
```

Option is enabled.

<br />

Constant Value:

1
(0x00000001)


### MIGRATION_OPTION_UNSPECIFIED

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public static final int MIGRATION_OPTION_UNSPECIFIED
```

Option is unspecified, platform default value will be used.

<br />

Constant Value:

0
(0x00000000)


## Public methods

### getAllowNonDefaultNetworkUsage

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public int getAllowNonDefaultNetworkUsage ()
```

See `https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions.Builder#setAllowNonDefaultNetworkUsage(int)`

<br />

| Returns ||
|---|---|
| `int` | Value is one of the following: - `https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions#MIGRATION_OPTION_UNSPECIFIED` - `https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions#MIGRATION_OPTION_ENABLED` - `https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions#MIGRATION_OPTION_DISABLED` |

### getDefaultNetworkMigration

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public int getDefaultNetworkMigration ()
```

See `https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions.Builder#setDefaultNetworkMigration(int)`

<br />

| Returns ||
|---|---|
| `int` | Value is one of the following: - `https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions#MIGRATION_OPTION_UNSPECIFIED` - `https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions#MIGRATION_OPTION_ENABLED` - `https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions#MIGRATION_OPTION_DISABLED` |

### getPathDegradationMigration

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public int getPathDegradationMigration ()
```

See `https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions.Builder#setPathDegradationMigration(int)`

<br />

| Returns ||
|---|---|
| `int` | Value is one of the following: - `https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions#MIGRATION_OPTION_UNSPECIFIED` - `https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions#MIGRATION_OPTION_ENABLED` - `https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions#MIGRATION_OPTION_DISABLED` |