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

# SubscribeConfig.Builder

*** ** * ** ***


`
public
static
final

class
SubscribeConfig.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.SubscribeConfig.Builder |

<br />

*** ** * ** ***

Builder used to build `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig` objects.

## Summary

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

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig` | ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#build()() ` Build `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig` given the current requests made on the builder. |
| ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setEgressDistanceMm(int)(int egressDistanceMm) ` An egress distance is configured to detect when the device exits a defined range. |
| ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setFrameworkOffloadedPairingEnabled(boolean)(boolean enabled) ` Configure whether to enable framework offloaded auto-pairing for this subscribe session. |
| ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setIngressDistanceMm(int)(int ingressDistanceMm) ` An ingress distance is configured to detect when the device enters a defined range. |
| ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setInstantCommunicationModeEnabled(boolean,%20int)(boolean enabled, int band) ` Configure whether to enable and use instant communication for this subscribe session. |
| ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setMatchFilter(java.util.List<byte[]>)(https://developer.android.com/reference/java/util/List<byte[]> matchFilter) ` The match filter for a subscribe session. |
| ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setMaxDistanceMm(int)(int maxDistanceMm) ` *This method was deprecated in API level 37. Use `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setIngressDistanceMm(int)` instead.* |
| ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setMinDistanceMm(int)(int minDistanceMm) ` *This method was deprecated in API level 37. Use `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setEgressDistanceMm(int)` instead.* |
| ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setPairingConfig(android.net.wifi.aware.AwarePairingConfig)(https://developer.android.com/reference/android/net/wifi/aware/AwarePairingConfig config) ` Set the `https://developer.android.com/reference/android/net/wifi/aware/AwarePairingConfig` for this subscribe session, the peer can use this info to determine the config of the following bootstrapping, pairing setup/verification request. |
| ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setServiceName(java.lang.String)(https://developer.android.com/reference/java/lang/String serviceName) ` Specify the service name of the subscribe session. |
| ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setServiceSpecificInfo(byte[])(byte[] serviceSpecificInfo) ` Specify service specific information for the subscribe session. |
| ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setSubscribeType(int)(int subscribeType) ` Sets the type of the subscribe session: active (subscribe packets are transmitted over-the-air), or passive (no subscribe packets are transmitted, a match is made against a solicited/active publish session whose packets are transmitted over-the-air). |
| ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setTerminateNotificationEnabled(boolean)(boolean enable) ` Configure whether a subscribe terminate notification `https://developer.android.com/reference/android/net/wifi/aware/DiscoverySessionCallback#onSessionTerminated()` is reported back to the callback. |
| ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | ` https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setTtlSec(int)(int ttlSec) ` Sets the time interval (in seconds) an active ( `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setSubscribeType(int)`) subscribe session will be alive - i.e. |

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

```
public Builder ()
```

Default constructor.

<br />

## Public methods

### build

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

```
public SubscribeConfig build ()
```

Build `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig` given the current requests made on the
builder.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig` | <br /> |

### setEgressDistanceMm

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

```
public SubscribeConfig.Builder setEgressDistanceMm (int egressDistanceMm)
```

An egress distance is configured to detect when the device exits a defined range. A
discovery result with range will be reported when the device moves out of the range of
the egress distance (outer threshold) to a matching publisher (based on the other
matching criteria in this configuration). This can be used in conjunction with
`https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setIngressDistanceMm(int)` to specify a geofence.


When both ingress (inner threshold) and egress (outer threshold) distances are set
for geofence, the ranging result will be reported when the device moves either into
the range of the inner threshold or out of the range of the outer threshold.


For ranging to be used in discovery it must also be enabled on the publisher using
`https://developer.android.com/reference/android/net/wifi/aware/PublishConfig.Builder#setRangingEnabled(boolean)`. However, ranging may
not be available or enabled on the publisher or may be temporarily disabled on either
subscriber or publisher - in such cases discovery will proceed without ranging.


When ranging is enabled and available on both publisher and subscriber and a service
is discovered based on geofence constraints the
`https://developer.android.com/reference/android/net/wifi/aware/DiscoverySessionCallback#onServiceDiscoveredWithinRange(android.net.wifi.aware.PeerHandle,%20byte[],%20java.util.List<byte[]>,%20int)`
is called, otherwise the
`https://developer.android.com/reference/android/net/wifi/aware/DiscoverySessionCallback#onServiceDiscovered(android.net.wifi.aware.PeerHandle,%20byte[],%20java.util.List<byte[]>)`
is called.


The device must support Wi-Fi RTT for this feature to be used. Feature support is checked
as described in `https://developer.android.com/reference/android/net/wifi/rtt/package-summary`.

<br />

<br />

| Parameters ||
|---|---|
| `egressDistanceMm` | `int`: Egress distance, in mm, to the publisher above which to trigger discovery. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. This value cannot be `null`. <br /> |

### setFrameworkOffloadedPairingEnabled

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

```
public SubscribeConfig.Builder setFrameworkOffloadedPairingEnabled (boolean enabled)
```

Configure whether to enable framework offloaded auto-pairing for this subscribe session.

If this is enabled, the wifi framework will attempt to perform Wi-Fi Aware pairing
automatically before starting the NAN datapath. When pairing happens for the first time,
user authorization may be required (such as entering a pincode or password on the system
UI).

As a result, apps are highly recommended to increase their connection timeout to at
least 30 seconds when starting a datapath with this field enabled. Additionally, if the
app is using framework offloaded pairing, the framework will override the `https://developer.android.com/reference/android/net/wifi/aware/AwarePairingConfig` with a framework managed configuration.

<br />

| Parameters ||
|---|---|
| `enabled` | `boolean`: If true, enable framework offloaded auto-pairing. <br /> |

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

### setIngressDistanceMm

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

```
public SubscribeConfig.Builder setIngressDistanceMm (int ingressDistanceMm)
```

An ingress distance is configured to detect when the device enters a defined range. A
discovery result with range will be reported when the device moves into the range of
the ingress distance (inner threshold) to a matching publisher (based on the other
matching criteria in this configuration). This can be used in conjunction with
`https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setEgressDistanceMm(int)` to specify a geofence.


When both ingress (inner threshold) and egress (outer threshold) distances are set
for geofence, the ranging result will be reported when the device moves either into
the range of the inner threshold or out of the range of the outer threshold.


For ranging to be used in discovery it must also be enabled on the publisher using
`https://developer.android.com/reference/android/net/wifi/aware/PublishConfig.Builder#setRangingEnabled(boolean)`. However, ranging may
not be available or enabled on the publisher or may be temporarily disabled on either
subscriber or publisher - in such cases discovery will proceed without ranging.


When ranging is enabled and available on both publisher and subscriber and a service
is discovered based on geofence constraints the
`https://developer.android.com/reference/android/net/wifi/aware/DiscoverySessionCallback#onServiceDiscoveredWithinRange(android.net.wifi.aware.PeerHandle,%20byte[],%20java.util.List<byte[]>,%20int)`
is called, otherwise the
`https://developer.android.com/reference/android/net/wifi/aware/DiscoverySessionCallback#onServiceDiscovered(android.net.wifi.aware.PeerHandle,%20byte[],%20java.util.List<byte[]>)`
is called.


The device must support Wi-Fi RTT for this feature to be used. Feature support is checked
as described in `https://developer.android.com/reference/android/net/wifi/rtt/package-summary`.

<br />

<br />

| Parameters ||
|---|---|
| `ingressDistanceMm` | `int`: Ingress distance, in mm, to the publisher below which to trigger discovery. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. This value cannot be `null`. <br /> |

### setInstantCommunicationModeEnabled

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

```
public SubscribeConfig.Builder setInstantCommunicationModeEnabled (boolean enabled, 
                int band)
```

Configure whether to enable and use instant communication for this subscribe session.
Instant communication will speed up service discovery and any data-path set up as part of
this session. Use `https://developer.android.com/reference/android/net/wifi/aware/Characteristics#isInstantCommunicationModeSupported()` to check
if the device supports this feature.

Note: due to increased power requirements of this mode - it will only remain enabled
for 30 seconds from the time the discovery session is started.

<br />

| Parameters ||
|---|---|
| `enabled` | `boolean`: true for enable instant communication mode, default is false. <br /> |
| `band` | `int`: When setting to `https://developer.android.com/reference/android/net/wifi/ScanResult#WIFI_BAND_5_GHZ`, device will try to enable instant communication mode on 5Ghz, but may fall back to 2.4Ghz due to regulatory requirements. Value is one of the following: - `https://developer.android.com/reference/android/net/wifi/ScanResult#WIFI_BAND_24_GHZ` - `https://developer.android.com/reference/android/net/wifi/ScanResult#WIFI_BAND_5_GHZ` |

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

### setMatchFilter

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

```
public SubscribeConfig.Builder setMatchFilter (List<byte[]> matchFilter)
```

The match filter for a subscribe session. Used to determine whether a service
discovery occurred - in addition to relying on the service name.


Optional. Empty by default.

<br />

| Parameters ||
|---|---|
| `matchFilter` | `List`: A list of match filter entries (each of which is an arbitrary byte array). This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. <br /> |

### setMaxDistanceMm

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

```
public SubscribeConfig.Builder setMaxDistanceMm (int maxDistanceMm)
```


**This method was deprecated
in API level 37.**   

Use `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setIngressDistanceMm(int)` instead.

Configure the maximum distance to a discovered publisher at which to trigger a discovery
notification. I.e. discovery will be triggered if we've found a matching publisher
(based on the other criteria in this configuration) **and** the distance to the
publisher is smaller than the value specified in this API. Can be used in conjunction
with `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setMinDistanceMm(int)` to specify a geofence, i.e. discovery with min \<=
distance \<= max.


For ranging to be used in discovery it must also be enabled on the publisher using
`https://developer.android.com/reference/android/net/wifi/aware/PublishConfig.Builder#setRangingEnabled(boolean)`. However, ranging may
not be available or enabled on the publisher or may be temporarily disabled on either
subscriber or publisher - in such cases discovery will proceed without ranging.


When ranging is enabled and available on both publisher and subscriber and a service
is discovered based on geofence constraints the
`https://developer.android.com/reference/android/net/wifi/aware/DiscoverySessionCallback#onServiceDiscoveredWithinRange(android.net.wifi.aware.PeerHandle,%20byte[],%20java.util.List<byte[]>,%20int)`
is called, otherwise the
`https://developer.android.com/reference/android/net/wifi/aware/DiscoverySessionCallback#onServiceDiscovered(android.net.wifi.aware.PeerHandle,%20byte[],%20java.util.List<byte[]>)`
is called.


The device must support Wi-Fi RTT for this feature to be used. Feature support is checked
as described in `https://developer.android.com/reference/android/net/wifi/rtt/package-summary`.


Note: The maximum distance is same as inner threshold of ingress geofence. This can be
less than `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setMinDistanceMm(int)` which is same as outer threshold of egress
geofence i.e. discovery with distance \<= max or distance \>= min.

<br />

| Parameters ||
|---|---|
| `maxDistanceMm` | `int`: Maximum distance, in mm, to the publisher below which to trigger discovery. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. <br /> |

### setMinDistanceMm

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

```
public SubscribeConfig.Builder setMinDistanceMm (int minDistanceMm)
```


**This method was deprecated
in API level 37.**   

Use `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setEgressDistanceMm(int)` instead.

Configure the minimum distance to a discovered publisher at which to trigger a discovery
notification. I.e. discovery will be triggered if we've found a matching publisher
(based on the other criteria in this configuration) **and** the distance to the
publisher is larger than the value specified in this API. Can be used in conjunction with
`https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setMaxDistanceMm(int)` to specify a geofence, i.e. discovery with min \<=
distance \<= max.


For ranging to be used in discovery it must also be enabled on the publisher using
`https://developer.android.com/reference/android/net/wifi/aware/PublishConfig.Builder#setRangingEnabled(boolean)`. However, ranging may
not be available or enabled on the publisher or may be temporarily disabled on either
subscriber or publisher - in such cases discovery will proceed without ranging.


When ranging is enabled and available on both publisher and subscriber and a service
is discovered based on geofence constraints the
`https://developer.android.com/reference/android/net/wifi/aware/DiscoverySessionCallback#onServiceDiscoveredWithinRange(android.net.wifi.aware.PeerHandle,%20byte[],%20java.util.List<byte[]>,%20int)`
is called, otherwise the
`https://developer.android.com/reference/android/net/wifi/aware/DiscoverySessionCallback#onServiceDiscovered(android.net.wifi.aware.PeerHandle,%20byte[],%20java.util.List<byte[]>)`
is called.


The device must support Wi-Fi RTT for this feature to be used. Feature support is checked
as described in `https://developer.android.com/reference/android/net/wifi/rtt/package-summary`.


Note: The minimum distance is same as outer threshold of egress geofence. This can be
more than `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setMaxDistanceMm(int)` which is same as inner threshold of ingress
geofence i.e. discovery with distance \<= max or distance \>= min.

<br />

| Parameters ||
|---|---|
| `minDistanceMm` | `int`: Minimum distance, in mm, to the publisher above which to trigger discovery. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. <br /> |

### setPairingConfig

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

```
public SubscribeConfig.Builder setPairingConfig (AwarePairingConfig config)
```

Set the `https://developer.android.com/reference/android/net/wifi/aware/AwarePairingConfig` for this subscribe session, the peer can use this info
to determine the config of the following bootstrapping, pairing setup/verification
request.

<br />

| Parameters ||
|---|---|
| `config` | `AwarePairingConfig`: The pairing config set to the peer. Only valid when `https://developer.android.com/reference/android/net/wifi/aware/Characteristics#isAwarePairingSupported()` is true. This value may be `null`. <br /> |

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

**See also:**

- `https://developer.android.com/reference/android/net/wifi/aware/AwarePairingConfig`

### setServiceName

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

```
public SubscribeConfig.Builder setServiceName (String serviceName)
```

Specify the service name of the subscribe session. The actual on-air
value is a 6 byte hashed representation of this string.


The Service Name is a UTF-8 encoded string from 1 to 255 bytes in length.
The only acceptable single-byte UTF-8 symbols for a Service Name are alphanumeric
values (A-Z, a-z, 0-9), the hyphen ('-'), the period ('.') and the underscore ('_'). All
valid multi-byte UTF-8 characters are acceptable in a Service Name.


Must be called - an empty ServiceName is not valid.

<br />

| Parameters ||
|---|---|
| `serviceName` | `String`: The service name for the subscribe session. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. <br /> |

### setServiceSpecificInfo

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

```
public SubscribeConfig.Builder setServiceSpecificInfo (byte[] serviceSpecificInfo)
```

Specify service specific information for the subscribe session. This is
a free-form byte array available to the application to send
additional information as part of the discovery operation - i.e. it
will not be used to determine whether a publish/subscribe match
occurs.


Optional. Empty by default.

<br />

| Parameters ||
|---|---|
| `serviceSpecificInfo` | `byte`: A byte-array for the service-specific information field. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. <br /> |

### setSubscribeType

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

```
public SubscribeConfig.Builder setSubscribeType (int subscribeType)
```

Sets the type of the subscribe session: active (subscribe packets are
transmitted over-the-air), or passive (no subscribe packets are
transmitted, a match is made against a solicited/active publish
session whose packets are transmitted over-the-air).

<br />

| Parameters ||
|---|---|
| `subscribeType` | `int`: Subscribe session type: `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig#SUBSCRIBE_TYPE_ACTIVE` or `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig#SUBSCRIBE_TYPE_PASSIVE`. Value is one of the following: - `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig#SUBSCRIBE_TYPE_PASSIVE` - `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig#SUBSCRIBE_TYPE_ACTIVE` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. <br /> |

### setTerminateNotificationEnabled

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

```
public SubscribeConfig.Builder setTerminateNotificationEnabled (boolean enable)
```

Configure whether a subscribe terminate notification
`https://developer.android.com/reference/android/net/wifi/aware/DiscoverySessionCallback#onSessionTerminated()` is reported
back to the callback.

<br />

| Parameters ||
|---|---|
| `enable` | `boolean`: If true the terminate callback will be called when the subscribe is terminated. Otherwise it will not be called. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. <br /> |

### setTtlSec

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

```
public SubscribeConfig.Builder setTtlSec (int ttlSec)
```

Sets the time interval (in seconds) an active (
`https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder#setSubscribeType(int)`) subscribe session
will be alive - i.e. broadcasting a packet. When the TTL is reached
an event will be generated for
`https://developer.android.com/reference/android/net/wifi/aware/DiscoverySessionCallback#onSessionTerminated()`.


Optional. 0 by default - indicating the session doesn't terminate on its own.
Session will be terminated when `https://developer.android.com/reference/android/net/wifi/aware/DiscoverySession#close()` is
called.

<br />

| Parameters ||
|---|---|
| `ttlSec` | `int`: Lifetime of a subscribe session in seconds. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/aware/SubscribeConfig.Builder` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. <br /> |