Builder


class Builder
kotlin.Any
   ↳ android.net.nsd.DiscoveryRequest.Builder

The builder for creating new DiscoveryRequest objects.

Summary

Public constructors
Builder(serviceType: String)

Creates a new default Builder object with given service type.

Public methods
DiscoveryRequest

Creates a new DiscoveryRequest object.

DiscoveryRequest.Builder
setNetwork(network: Network?)

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

DiscoveryRequest.Builder
setSubtype(subtype: String?)

Sets the optional subtype of the services to be discovered.

Public constructors

Builder

Builder(serviceType: String)

Creates a new default Builder object with given service type.

Parameters
serviceType String: This value cannot be null.
Exceptions
java.lang.IllegalArgumentException if serviceType is null or an empty string

Public methods

build

fun build(): DiscoveryRequest

Creates a new DiscoveryRequest object.

Return
DiscoveryRequest This value cannot be null.

setNetwork

fun setNetwork(network: Network?): DiscoveryRequest.Builder

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
Return
DiscoveryRequest.Builder This value cannot be null.

setSubtype

fun setSubtype(subtype: String?): DiscoveryRequest.Builder

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, android.net.nsd.NsdManager#discoverServices will fail with android.net.nsd.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 #setServiceType if a non-empty subtype is specified by this method.

Parameters
subtype String?: This value may be null.
Return
DiscoveryRequest.Builder This value cannot be null.