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

# AwareDataPathRequest.Builder

*** ** * ** ***

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

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.net.wifi.aware.AwareDataPathRequest.Builder |

<br />

*** ** * ** ***

A builder class for a Wi-Fi Aware data path request to set up a data path with a peer device.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/net/wifi/aware/AwareDataPathRequest.Builder#Builder()() ` |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/net/wifi/aware/AwareDataPathRequest` | ` https://developer.android.com/reference/android/net/wifi/aware/AwareDataPathRequest.Builder#build()() ` Build the `https://developer.android.com/reference/android/net/wifi/aware/AwareDataPathRequest` object. |
| ` https://developer.android.com/reference/android/net/wifi/aware/AwareDataPathRequest.Builder` | ` https://developer.android.com/reference/android/net/wifi/aware/AwareDataPathRequest.Builder#setDataPathSecurityConfig(android.net.wifi.aware.WifiAwareDataPathSecurityConfig)(https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig securityConfig) ` Configure security config for the Wi-Fi Aware connection being requested. |
| ` https://developer.android.com/reference/android/net/wifi/aware/AwareDataPathRequest.Builder` | ` https://developer.android.com/reference/android/net/wifi/aware/AwareDataPathRequest.Builder#setPort(int)(int port) ` Configure the port number which will be used to create a connection over this link. |
| ` https://developer.android.com/reference/android/net/wifi/aware/AwareDataPathRequest.Builder` | ` https://developer.android.com/reference/android/net/wifi/aware/AwareDataPathRequest.Builder#setTransportProtocol(int)(int transportProtocol) ` Configure the transport protocol which will be used to create a connection over this link. |

### 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 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Builder ()
```

<br />

<br />

## Public methods

### build

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

```
public AwareDataPathRequest build ()
```

Build the `https://developer.android.com/reference/android/net/wifi/aware/AwareDataPathRequest` object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/aware/AwareDataPathRequest` | the `https://developer.android.com/` object. This value cannot be `null`. <br /> |

### setDataPathSecurityConfig

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

```
public AwareDataPathRequest.Builder setDataPathSecurityConfig (WifiAwareDataPathSecurityConfig securityConfig)
```

Configure security config for the Wi-Fi Aware connection being requested. This method is optional - if not called, then an Open (unencrypted) connection will be created.

<br />

| Parameters ||
|---|---|
| `securityConfig` | `WifiAwareDataPathSecurityConfig`: The (optional) security config to be used to encrypt the link. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/aware/AwareDataPathRequest.Builder` | the current `https://developer.android.com/reference/android/net/wifi/aware/AwareDataPathRequest.Builder` builder, enabling chaining of builder methods. This value cannot be `null`. <br /> |

### setPort

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

```
public AwareDataPathRequest.Builder setPort (int port)
```

Configure the port number which will be used to create a connection over this link. This configuration should only be done on the server device, e.g. the device creating the `https://developer.android.com/reference/java/net/ServerSocket`.

Notes:

- The server device must be the Publisher device!
- The port information can only be specified on secure links, specified using `https://developer.android.com/reference/android/net/wifi/aware/AwareDataPathRequest.Builder#setDataPathSecurityConfig(android.net.wifi.aware.WifiAwareDataPathSecurityConfig)`

<br />

<br />

| Parameters ||
|---|---|
| `port` | `int`: A positive integer indicating the port to be used for communication. Value is between 1 and 65535 inclusive <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/aware/AwareDataPathRequest.Builder` | the current `https://developer.android.com/reference/android/net/wifi/aware/AwareDataPathRequest.Builder` builder, enabling chaining of builder methods. This value cannot be `null`. <br /> |

### setTransportProtocol

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

```
public AwareDataPathRequest.Builder setTransportProtocol (int transportProtocol)
```

Configure the transport protocol which will be used to create a connection over this link. This configuration should only be done on the server device, e.g. the device creating the `https://developer.android.com/reference/java/net/ServerSocket` for TCP.

Notes:

- The server device must be the Publisher device!
- The transport protocol information can only be specified on secure links, specified using `https://developer.android.com/reference/android/net/wifi/aware/AwareDataPathRequest.Builder#setDataPathSecurityConfig(android.net.wifi.aware.WifiAwareDataPathSecurityConfig)`.

The transport protocol number is assigned by the Internet Assigned Numbers Authority (IANA) https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml.

<br />

<br />

| Parameters ||
|---|---|
| `transportProtocol` | `int`: The transport protocol to be used for communication. Value is between 0 and 255 inclusive <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/aware/AwareDataPathRequest.Builder` | the current `https://developer.android.com/reference/android/net/wifi/aware/AwareDataPathRequest.Builder` builder, enabling chaining of builder methods. This value cannot be `null`. <br /> |