Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#inhmethods)

# IkeSessionParams.Builder

*** ** * ** ***

` public static final class IkeSessionParams.Builder `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.net.ipsec.ike.IkeSessionParams.Builder |

<br />

*** ** * ** ***

This class can be used to incrementally construct a `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams`.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#Builder()() ` Construct Builder |
| ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#Builder(android.net.ipsec.ike.IkeSessionParams)(https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams ikeSessionParams) ` Construct Builder from the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams` object. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#addIkeOption(int)(int ikeOption) ` Sets the specified IKE Option as enabled. |
| ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#addIkeSaProposal(android.net.ipsec.ike.IkeSaProposal)(https://developer.android.com/reference/android/net/ipsec/ike/IkeSaProposal proposal) ` Adds an IKE SA proposal to the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams` being built. |
| ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#build()() ` Validates and builds the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams`. |
| ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#removeIkeOption(int)(int ikeOption) ` Resets (disables) the specified IKE Option. |
| ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#setAuthDigitalSignature(java.security.cert.X509Certificate,%20java.security.cert.X509Certificate,%20java.util.List<java.security.cert.X509Certificate>,%20java.security.PrivateKey)(https://developer.android.com/reference/java/security/cert/X509Certificate serverCaCert, https://developer.android.com/reference/java/security/cert/X509Certificate clientEndCert, https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/security/cert/X509Certificate> clientIntermediateCerts, https://developer.android.com/reference/java/security/PrivateKey clientPrivateKey) ` Configures the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSession` to use public-key-signature-based authentication. |
| ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#setAuthDigitalSignature(java.security.cert.X509Certificate,%20java.security.cert.X509Certificate,%20java.security.PrivateKey)(https://developer.android.com/reference/java/security/cert/X509Certificate serverCaCert, https://developer.android.com/reference/java/security/cert/X509Certificate clientEndCert, https://developer.android.com/reference/java/security/PrivateKey clientPrivateKey) ` Configures the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSession` to use public-key-signature-based authentication. |
| ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#setAuthEap(java.security.cert.X509Certificate,%20android.net.eap.EapSessionConfig)(https://developer.android.com/reference/java/security/cert/X509Certificate serverCaCert, https://developer.android.com/reference/android/net/eap/EapSessionConfig eapConfig) ` Configures the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSession` to use EAP authentication. |
| ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#setAuthPsk(byte[])(byte[] sharedKey) ` Configures the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSession` to use pre-shared-key-based authentication. |
| ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#setDpdDelaySeconds(int)(int dpdDelaySeconds) ` Sets the Dead Peer Detection(DPD) delay in seconds. |
| ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#setLifetimeSeconds(int,%20int)(int hardLifetimeSeconds, int softLifetimeSeconds) ` Sets hard and soft lifetimes. |
| ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#setLocalIdentification(android.net.ipsec.ike.IkeIdentification)(https://developer.android.com/reference/android/net/ipsec/ike/IkeIdentification identification) ` Sets local IKE identification for the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams` being built. |
| ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#setNattKeepAliveDelaySeconds(int)(int nattKeepaliveDelaySeconds) ` Sets the Network Address Translation Traversal (NATT) keepalive delay in seconds. |
| ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#setNetwork(android.net.Network)(https://developer.android.com/reference/android/net/Network network) ` Sets the `https://developer.android.com/reference/android/net/Network` for the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams` being built. |
| ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#setRemoteIdentification(android.net.ipsec.ike.IkeIdentification)(https://developer.android.com/reference/android/net/ipsec/ike/IkeIdentification identification) ` Sets remote IKE identification for the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams` being built. |
| ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#setRetransmissionTimeoutsMillis(int[])(int[] retransTimeoutMillisList) ` Sets the retransmission timeout list in milliseconds. |
| ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#setServerHostname(java.lang.String)(https://developer.android.com/reference/java/lang/String serverHostname) ` Sets the server hostname for the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams` being built. |

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

## Public constructors

### Builder

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

```
public Builder ()
```

Construct Builder

<br />

### Builder

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

```
public Builder (IkeSessionParams ikeSessionParams)
```

Construct Builder from the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams` object.

<br />

| Parameters ||
|---|---|
| `ikeSessionParams` | `IkeSessionParams`: the object this Builder will be constructed with. This value cannot be `null`. <br /> |

## Public methods

### addIkeOption

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

```
public IkeSessionParams.Builder addIkeOption (int ikeOption)
```

Sets the specified IKE Option as enabled.

<br />

| Parameters ||
|---|---|
| `ikeOption` | `int`: the option to be enabled. Value is one of the following: - `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_ACCEPT_ANY_REMOTE_ID` - `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_EAP_ONLY_AUTH` - `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_MOBIKE` - `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_FORCE_PORT_4500` - `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_INITIAL_CONTACT` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | Builder this, to facilitate chaining. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the provided option is invalid. |

### addIkeSaProposal

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

```
public IkeSessionParams.Builder addIkeSaProposal (IkeSaProposal proposal)
```

Adds an IKE SA proposal to the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams` being built.

<br />

| Parameters ||
|---|---|
| `proposal` | `IkeSaProposal`: IKE SA proposal. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | Builder this, to facilitate chaining. This value cannot be `null`. <br /> |

### build

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

```
public IkeSessionParams build ()
```

Validates and builds the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams` | IkeSessionParams the validated IkeSessionParams. This value cannot be `null`. <br /> |

### removeIkeOption

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

```
public IkeSessionParams.Builder removeIkeOption (int ikeOption)
```

Resets (disables) the specified IKE Option.

<br />

| Parameters ||
|---|---|
| `ikeOption` | `int`: the option to be disabled. Value is one of the following: - `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_ACCEPT_ANY_REMOTE_ID` - `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_EAP_ONLY_AUTH` - `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_MOBIKE` - `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_FORCE_PORT_4500` - `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_INITIAL_CONTACT` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | Builder this, to facilitate chaining. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the provided option is invalid. |

### setAuthDigitalSignature

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

```
public IkeSessionParams.Builder setAuthDigitalSignature (X509Certificate serverCaCert, 
                X509Certificate clientEndCert, 
                List<X509Certificate> clientIntermediateCerts, 
                PrivateKey clientPrivateKey)
```

Configures the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSession` to use public-key-signature-based authentication.

The public key included by the client end certificate and the private key used for signing MUST be a matching key pair.

The IKE library will use the strongest signature algorithm supported by both sides.

Currenly only RSA digital signature is supported.

<br />

| Parameters ||
|---|---|
| `serverCaCert` | `X509Certificate`: the CA certificate for validating the received server certificate(s). If a null value is provided, IKE library will try all default CA certificates stored in Android system to do the validation. Otherwise, it will only use the provided CA certificate. <br /> |
| `clientEndCert` | `X509Certificate`: the end certificate for remote server to verify locally generated signature. This value cannot be `null`. <br /> |
| `clientIntermediateCerts` | `List`: intermediate certificates for the remote server to validate the end certificate. This value cannot be `null`. <br /> |
| `clientPrivateKey` | `PrivateKey`: private key to generate outbound digital signature. The `https://developer.android.com/reference/java/security/PrivateKey` MUST be an instance of `https://developer.android.com/reference/java/security/interfaces/RSAKey`. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | Builder this, to facilitate chaining. This value cannot be `null`. <br /> |

### setAuthDigitalSignature

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

```
public IkeSessionParams.Builder setAuthDigitalSignature (X509Certificate serverCaCert, 
                X509Certificate clientEndCert, 
                PrivateKey clientPrivateKey)
```

Configures the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSession` to use public-key-signature-based authentication.

The public key included by the client end certificate and the private key used for signing MUST be a matching key pair.

The IKE library will use the strongest signature algorithm supported by both sides.

Currenly only RSA digital signature is supported.

<br />

| Parameters ||
|---|---|
| `serverCaCert` | `X509Certificate`: the CA certificate for validating the received server certificate(s). If a certificate is provided, it MUST be the root CA used by the server, or authentication will fail. If no certificate is provided, any root CA in the system's truststore is considered acceptable. This value may be `null`. <br /> |
| `clientEndCert` | `X509Certificate`: the end certificate for remote server to verify the locally generated signature. This value cannot be `null`. <br /> |
| `clientPrivateKey` | `PrivateKey`: private key to generate outbound digital signature. The `https://developer.android.com/reference/java/security/PrivateKey` MUST be an instance of `https://developer.android.com/reference/java/security/interfaces/RSAKey`. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | Builder this, to facilitate chaining. This value cannot be `null`. <br /> |

### setAuthEap

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

```
public IkeSessionParams.Builder setAuthEap (X509Certificate serverCaCert, 
                EapSessionConfig eapConfig)
```

Configures the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSession` to use EAP authentication.

Not all EAP methods provide mutual authentication. As such EAP MUST be used in conjunction with a public-key-signature-based authentication of the remote server, unless EAP-Only authentication is enabled.

Callers may enable EAP-Only authentication by setting `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_EAP_ONLY_AUTH`, which will make IKE library request the remote to use EAP-Only authentication. The remote may opt to reject the request, at which point the received certificates and authentication payload WILL be validated with the provided root CA or system's truststore as usual. Only safe EAP methods as listed in RFC 5998 will be accepted for EAP-Only authentication.

If `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_EAP_ONLY_AUTH` is set, callers MUST configure EAP as the authentication method and all EAP methods set in EAP Session configuration MUST be safe methods that are accepted for EAP-Only authentication. Otherwise callers will get an exception when building the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams`

Callers MUST declare only one authentication method. Calling this function will override the previously set authentication configuration.

<br />

| Parameters ||
|---|---|
| `serverCaCert` | `X509Certificate`: the CA certificate for validating the received server certificate(s). If a certificate is provided, it MUST be the root CA used by the server, or authentication will fail. If no certificate is provided, any root CA in the system's truststore is considered acceptable. This value may be `null`. <br /> |
| `eapConfig` | `EapSessionConfig`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | Builder this, to facilitate chaining. This value cannot be `null`. <br /> |

**See also:**

- [RFC 5280, Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile](https://tools.ietf.org/html/rfc5280)
- [RFC 5998, An Extension for EAP-Only Authentication in IKEv2](https://tools.ietf.org/html/rfc5998)

### setAuthPsk

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

```
public IkeSessionParams.Builder setAuthPsk (byte[] sharedKey)
```

Configures the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSession` to use pre-shared-key-based authentication.

Both client and server MUST be authenticated using the provided shared key. IKE authentication will fail if the remote peer tries to use other authentication methods.

Callers MUST declare only one authentication method. Calling this function will override the previously set authentication configuration.

Callers SHOULD NOT use this if any other authentication methods can be used; PSK-based authentication is generally considered insecure.

<br />

| Parameters ||
|---|---|
| `sharedKey` | `byte`: the shared key. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | Builder this, to facilitate chaining. This value cannot be `null`. <br /> |

### setDpdDelaySeconds

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

```
public IkeSessionParams.Builder setDpdDelaySeconds (int dpdDelaySeconds)
```

Sets the Dead Peer Detection(DPD) delay in seconds.

<br />

| Parameters ||
|---|---|
| `dpdDelaySeconds` | `int`: number of seconds after which IKE SA will initiate DPD if no inbound cryptographically protected IKE message was received. Defaults to 120 seconds. MUST be a value greater than or equal to than 20 seconds. Setting the value to `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_DPD_DELAY_SEC_DISABLED` will disable DPD. Value is `https://developer.android.com/` or greater <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | Builder this, to facilitate chaining. This value cannot be `null`. <br /> |

### setLifetimeSeconds

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

```
public IkeSessionParams.Builder setLifetimeSeconds (int hardLifetimeSeconds, 
                int softLifetimeSeconds)
```

Sets hard and soft lifetimes.

Lifetimes will not be negotiated with the remote IKE server.

<br />

| Parameters ||
|---|---|
| `hardLifetimeSeconds` | `int`: number of seconds after which IKE SA will expire. Defaults to 14400 seconds (4 hours). MUST be a value from 300 seconds (5 minutes) to 86400 seconds (24 hours), inclusive. Value is between `https://developer.android.com/` and `https://developer.android.com/` inclusive <br /> |
| `softLifetimeSeconds` | `int`: number of seconds after which IKE SA will request rekey. Defaults to 7200 seconds (2 hours). MUST be at least 120 seconds (2 minutes), and at least 60 seconds (1 minute) shorter than the hard lifetime. Value is between `https://developer.android.com/` and `https://developer.android.com/` inclusive <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | Builder this, to facilitate chaining. This value cannot be `null`. <br /> |

### setLocalIdentification

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

```
public IkeSessionParams.Builder setLocalIdentification (IkeIdentification identification)
```

Sets local IKE identification for the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams` being built.

It is not allowed to use KEY ID together with digital-signature-based authentication as per RFC 7296.

<br />

| Parameters ||
|---|---|
| `identification` | `IkeIdentification`: the local IKE identification. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | Builder this, to facilitate chaining. This value cannot be `null`. <br /> |

### setNattKeepAliveDelaySeconds

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

```
public IkeSessionParams.Builder setNattKeepAliveDelaySeconds (int nattKeepaliveDelaySeconds)
```

Sets the Network Address Translation Traversal (NATT) keepalive delay in seconds.

<br />

| Parameters ||
|---|---|
| `nattKeepaliveDelaySeconds` | `int`: number of seconds between keepalive packet transmissions. Defaults to 10 seconds. MUST be a value from 10 seconds to 3600 seconds, inclusive. Value is between `https://developer.android.com/` and `https://developer.android.com/` inclusive <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | Builder this, to facilitate chaining. This value cannot be `null`. <br /> |

### setNetwork

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

```
public IkeSessionParams.Builder setNetwork (Network network)
```

Sets the `https://developer.android.com/reference/android/net/Network` for the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams` being built.

If no `https://developer.android.com/reference/android/net/Network` is provided, the default Network (as per `https://developer.android.com/reference/android/net/ConnectivityManager#getActiveNetwork()`) will be used when constructing an `https://developer.android.com/reference/android/net/ipsec/ike/IkeSession`.

<br />

| Parameters ||
|---|---|
| `network` | `Network`: the `https://developer.android.com/reference/android/net/Network` that IKE Session will use, or `null` to clear the previously set `https://developer.android.com/reference/android/net/Network` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | Builder this, to facilitate chaining. This value cannot be `null`. <br /> |

### setRemoteIdentification

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

```
public IkeSessionParams.Builder setRemoteIdentification (IkeIdentification identification)
```

Sets remote IKE identification for the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams` being built.

<br />

| Parameters ||
|---|---|
| `identification` | `IkeIdentification`: the remote IKE identification. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | Builder this, to facilitate chaining. This value cannot be `null`. <br /> |

### setRetransmissionTimeoutsMillis

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

```
public IkeSessionParams.Builder setRetransmissionTimeoutsMillis (int[] retransTimeoutMillisList)
```

Sets the retransmission timeout list in milliseconds.

Configures the retransmission by providing an array of relative retransmission timeouts in milliseconds. After sending out a request and before receiving the response, the IKE Session will iterate through the array and wait for the relative timeout before the next retry. If the last timeout is exceeded, the IKE Session will be terminated.

Each element in the array MUST be a value from 500 ms to 1800000 ms (30 minutes). The length of the array MUST NOT exceed 10. This retransmission timeout list defaults to {0.5s, 1s, 2s, 4s, 8s}

<br />

| Parameters ||
|---|---|
| `retransTimeoutMillisList` | `int`: the array of relative retransmission timeout in milliseconds. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | Builder this, to facilitate chaining. This value cannot be `null`. <br /> |

### setServerHostname

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

```
public IkeSessionParams.Builder setServerHostname (String serverHostname)
```

Sets the server hostname for the `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams` being built.

<br />

| Parameters ||
|---|---|
| `serverHostname` | `String`: the hostname of the IKE server, such as "ike.android.com". This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` | Builder this, to facilitate chaining. This value cannot be `null`. <br /> |