# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Ctors | Methods | Inherited Methods

# SubscribeConfig.Builder

`public static final class SubscribeConfig.Builder`
`extends Object` ``

java.lang.Object
↳ | android.net.wifi.aware.SubscribeConfig.Builder

Builder used to build `SubscribeConfig` objects.

## Summary

### Public constructors
`Builder()`

### Public methods
`SubscribeConfig` | `build()` Build `SubscribeConfig` given the current requests made on the builder.
`SubscribeConfig.Builder` | `setMatchFilter(List<byte[]> matchFilter)` The match filter for a subscribe session.
`SubscribeConfig.Builder` | `setMaxDistanceMm(int maxDistanceMm)` Configure the maximum distance to a discovered publisher at which to trigger a discovery notification.
`SubscribeConfig.Builder` | `setMinDistanceMm(int minDistanceMm)` Configure the minimum distance to a discovered publisher at which to trigger a discovery notification.
`SubscribeConfig.Builder` | `setServiceName(String serviceName)` Specify the service name of the subscribe session.
`SubscribeConfig.Builder` | `setServiceSpecificInfo(byte[] serviceSpecificInfo)` Specify service specific information for the subscribe session.
`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).
`SubscribeConfig.Builder` | `setTerminateNotificationEnabled(boolean enable)` Configure whether a subscribe terminate notification `DiscoverySessionCallback#onSessionTerminated()` is reported back to the callback.
`SubscribeConfig.Builder` | `setTtlSec(int ttlSec)` Sets the time interval (in seconds) an active ( `SubscribeConfig.Builder#setSubscribeType(int)`) subscribe session will be alive - i.e.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Public constructors

### Builder

    public Builder ()

## Public methods

### build

    public SubscribeConfig build ()

Build `SubscribeConfig` given the current requests made on the builder.

Returns
`SubscribeConfig` |

### setMatchFilter

    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.

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

Returns
`SubscribeConfig.Builder` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`.

### setMaxDistanceMm

    public SubscribeConfig.Builder setMaxDistanceMm (int maxDistanceMm)

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 `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 `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 `DiscoverySessionCallback#onServiceDiscoveredWithinRange(PeerHandle, byte[], List, int)` is called, otherwise the `DiscoverySessionCallback#onServiceDiscovered(PeerHandle, byte[], List)` is called.

The device must support Wi-Fi RTT for this feature to be used. Feature support is checked as described in `android.net.wifi.rtt`.

Parameters
`maxDistanceMm` | `int`: Maximum distance, in mm, to the publisher below which to trigger discovery.

Returns
`SubscribeConfig.Builder` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`.

### setMinDistanceMm

    public SubscribeConfig.Builder setMinDistanceMm (int minDistanceMm)

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 `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 `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 `DiscoverySessionCallback#onServiceDiscoveredWithinRange(PeerHandle, byte[], List, int)` is called, otherwise the `DiscoverySessionCallback#onServiceDiscovered(PeerHandle, byte[], List)` is called.

The device must support Wi-Fi RTT for this feature to be used. Feature support is checked as described in `android.net.wifi.rtt`.

Parameters
`minDistanceMm` | `int`: Minimum distance, in mm, to the publisher above which to trigger discovery.

Returns
`SubscribeConfig.Builder` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`.

### setServiceName

    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 ('-'), and the period ('.'). All valid multi-byte UTF-8 characters are acceptable in a Service Name.

Must be called - an empty ServiceName is not valid.

Parameters
`serviceName` | `String`: The service name for the subscribe session. This value cannot be `null`.

Returns
`SubscribeConfig.Builder` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`.

### setServiceSpecificInfo

    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.

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

Returns
`SubscribeConfig.Builder` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`.

### setSubscribeType

    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).

Parameters
`subscribeType` | `int`: Subscribe session type: `SubscribeConfig#SUBSCRIBE_TYPE_ACTIVE` or `SubscribeConfig#SUBSCRIBE_TYPE_PASSIVE`. Value is `SubscribeConfig.SUBSCRIBE_TYPE_PASSIVE`, or `SubscribeConfig.SUBSCRIBE_TYPE_ACTIVE`

Returns
`SubscribeConfig.Builder` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`.

### setTerminateNotificationEnabled

    public SubscribeConfig.Builder setTerminateNotificationEnabled (boolean enable)

Configure whether a subscribe terminate notification `DiscoverySessionCallback#onSessionTerminated()` is reported back to the callback.

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

Returns
`SubscribeConfig.Builder` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`.

### setTtlSec

    public SubscribeConfig.Builder setTtlSec (int ttlSec)

Sets the time interval (in seconds) an active ( `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 `DiscoverySessionCallback#onSessionTerminated()`.

Optional. 0 by default - indicating the session doesn't terminate on its own. Session will be terminated when `DiscoverySession#close()` is called.

Parameters
`ttlSec` | `int`: Lifetime of a subscribe session in seconds.

Returns
`SubscribeConfig.Builder` | The builder to facilitate chaining `builder.setXXX(..).setXXX(..)`.

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*