DiscoveryRequest.Builder


public static final class DiscoveryRequest.Builder
extends Object

java.lang.Object
   ↳ android.net.nsd.DiscoveryRequest.Builder


The builder for creating new DiscoveryRequest objects.

Summary

Public constructors

Builder(String serviceType)

Creates a new default Builder object with given service type.

Public methods

DiscoveryRequest build()

Creates a new DiscoveryRequest object.

DiscoveryRequest.Builder setNetwork(Network network)

Sets the Network on which the discovery queries should be sent.

DiscoveryRequest.Builder setSubtype(String subtype)

Sets the optional subtype of the services to be discovered.

Inherited methods

Public constructors

Builder

Added in T Extensions 12
public Builder (String serviceType)

Creates a new default Builder object with given service type.

Parameters
serviceType String: This value cannot be null.

Throws
IllegalArgumentException if serviceType is null or an empty string

Public methods

build

Added in T Extensions 12
public DiscoveryRequest build ()

Creates a new DiscoveryRequest object.

Returns
DiscoveryRequest This value cannot be null.

setNetwork

Added in T Extensions 12
public DiscoveryRequest.Builder setNetwork (Network network)

Sets the Network on which the discovery queries should be sent.

Parameters
network Network: the discovery network or null if the query should be sent on all supported networks

Returns
DiscoveryRequest.Builder This value cannot be null.

setSubtype

Added in T Extensions 12
public DiscoveryRequest.Builder setSubtype (String subtype)

Sets the optional subtype of the services to be discovered. If a non-empty subtype is specified, it must start with underscore ('_') and have the trailing "._sub" removed. Otherwise, NsdManager#discoverServices will fail with ERROR(NsdManager#FAILURE_BAD_PARAMETER/android.net.nsd.NsdManager#FAILURE_BAD_PARAMETER NsdManager#FAILURE_BAD_PARAMETER). For example, subtype should be "_printer" for DNS name "_printer._sub._http._tcp". In this case, only services with this subtype will be queried, rather than all services of the base service type. Note that a non-empty service type must be specified with ERROR(/#setServiceType) if a non-empty subtype is specified by this method.

Parameters
subtype String: This value may be null.

Returns
DiscoveryRequest.Builder This value cannot be null.