java.lang.Object | |
↳ | com.google.android.gms.nearby.messages.Strategy |
Describes a set of strategies for publishing or subscribing for nearby messages. If one of the
provided strategies doesn't work, consider using a Strategy.Builder
.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Strategy.Builder | Builder for Strategy . |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | DISCOVERY_MODE_BROADCAST | To discover which devices are nearby, broadcast a pairing code for others to scan. | |||||||||
int | DISCOVERY_MODE_DEFAULT | To discover which devices are nearby, broadcast a pairing code and scan for other devices' pairing codes. | |||||||||
int | DISCOVERY_MODE_SCAN | To discover which devices are nearby, scan for other devices' pairing codes. | |||||||||
int | DISTANCE_TYPE_DEFAULT | Allows the message be exchanged over any distance. | |||||||||
int | DISTANCE_TYPE_EARSHOT | Allows the message be exchanged within earshot only. | |||||||||
int | TTL_SECONDS_DEFAULT | The default time to live in seconds. | |||||||||
int | TTL_SECONDS_INFINITE | An infinite time to live in seconds. | |||||||||
int | TTL_SECONDS_MAX | The maximum time to live in seconds, if not TTL_SECONDS_INFINITE . |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
BLE_ONLY | Use only Bluetooth Low Energy to discover nearby devices. | ||||||||||
CREATOR | |||||||||||
DEFAULT | The default strategy, which is suitable for most applications. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
To discover which devices are nearby, broadcast a pairing code for others to scan.
To discover which devices are nearby, broadcast a pairing code and scan for other devices'
pairing codes. This is equivalent to DISCOVERY_MODE_BROADCAST
| DISCOVERY_MODE_SCAN
.
To discover which devices are nearby, scan for other devices' pairing codes.
Allows the message be exchanged over any distance.
Allows the message be exchanged within earshot only.
It is recommended that this configuration is used in conjunction with DISCOVERY_MODE_BROADCAST
. This will improve the detection latency.
The default time to live in seconds.
An infinite time to live in seconds.
Note: This is currently only supported for subscriptions.
The maximum time to live in seconds, if not TTL_SECONDS_INFINITE
.
Use only Bluetooth Low Energy to discover nearby devices. Recommended if you are only interested in messages attached to BLE beacons.
The time to live of this strategy is TTL_SECONDS_INFINITE
and as such it's only
supported for subscriptions.
Bluetooth Low Energy is not supported on all Android devices.
The default strategy, which is suitable for most applications.
The default behavior is currently doing broadcasts and scans, using all available sensors, to discover nearby devices, regardless of distance.
Parameters | |
---|---|
other |
Object
|
Returns | |
---|---|
boolean |
Returns | |
---|---|
int |
Returns | |
---|---|
String |
Parameters | |
---|---|
out |
Parcel
|
flags |
int
|