java.lang.Object | |
↳ | com.google.android.gms.nearby.messages.Strategy.Builder |
Builder for Strategy
.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new
Strategy.Builder . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Builds an instance of
Strategy . | |||||||||||
Sets the desired discovery mode that determines how devices will detect each other.
| |||||||||||
If used with a publish, the published message will only be delivered to subscribing devices
that are at most the specified distance from this device.
| |||||||||||
Sets the time to live in seconds for the publish or subscribe.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Creates a new Strategy.Builder
. By default it will have the same settings as a DEFAULT
strategy.
Sets the desired discovery mode that determines how devices will detect each other.
The discovery mode is orthogonal to if device is publishing or subscribing for messages. It's just the mechanism for detecting nearby devices. By default, the devices will broadcast and scan for pairing codes, so other devices can detect the originator from either a scan or a broadcast as well or both. Doing both allows for inclusion of devices that can only broadcast.
Parameters | |
---|---|
discoveryMode |
int :
One of Strategy.DISCOVERY_MODE_* specifying how to detect nearby
devices.
|
Returns | |
---|---|
Strategy.Builder |
If used with a publish, the published message will only be delivered to subscribing devices that are at most the specified distance from this device.
If used with a subscribe, messages will only be delivered if the publishing device is at most the specified distance from this device.
Parameters | |
---|---|
distanceType |
int :
One of Strategy.DISTANCE_TYPE_* specifying how close nearby
devices must be.
|
Returns | |
---|---|
Strategy.Builder |
Sets the time to live in seconds for the publish or subscribe. This must be either TTL_SECONDS_INFINITE
, or a positive integer between 1 and TTL_SECONDS_MAX
,
inclusive.
If not set, TTL_SECONDS_DEFAULT
is used instead.
Parameters | |
---|---|
ttlSeconds |
int
|
Returns | |
---|---|
Strategy.Builder |