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 Class Summary
class | Strategy.Builder | Builder for Strategy . |
Constant Summary
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 . |
Inherited Constant Summary
Field Summary
public static final Strategy | BLE_ONLY | This field is deprecated. Use DEFAULT
instead, which is also limited to only BLE. |
public static final Creator<Strategy> | CREATOR | |
public static final Strategy | DEFAULT | The default strategy, which is suitable for most applications. |
Public Method Summary
boolean | |
int |
hashCode()
|
String |
toString()
|
void |
writeToParcel(Parcel out, int
flags)
|
Inherited Method Summary
Constants
public static final int DISCOVERY_MODE_BROADCAST
To discover which devices are nearby, broadcast a pairing code for others to scan.
public static final int DISCOVERY_MODE_DEFAULT
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
.
public static final int DISCOVERY_MODE_SCAN
To discover which devices are nearby, scan for other devices' pairing codes.
public static final int DISTANCE_TYPE_DEFAULT
Allows the message be exchanged over any distance.
public static final int DISTANCE_TYPE_EARSHOT
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.
public static final int TTL_SECONDS_DEFAULT
The default time to live in seconds.
public static final int TTL_SECONDS_INFINITE
An infinite time to live in seconds.
Note: This is currently only supported for subscriptions.
public static final int TTL_SECONDS_MAX
The maximum time to live in seconds, if not
TTL_SECONDS_INFINITE
.
Fields
public static final Strategy BLE_ONLY
This field is deprecated.
Use DEFAULT
instead, which is also limited to only BLE.
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.
public static final Strategy DEFAULT
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.