java.lang.Object | |
↳ | com.google.android.gms.nearby.connection.Strategy |
The Strategy to be used when discovering or advertising to Nearby devices. The Strategy defines
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
P2P_CLUSTER | Peer-to-peer strategy that supports an M-to-N, or cluster-shaped, connection topology. | ||||||||||
P2P_POINT_TO_POINT | Peer-to-peer strategy that supports a 1-to-1 connection topology. | ||||||||||
P2P_STAR | Peer-to-peer strategy that supports a 1-to-N, or star-shaped, connection topology. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Peer-to-peer strategy that supports an M-to-N, or cluster-shaped, connection topology. In other words, this enables connecting amorphous clusters of devices within radio range (~100m), where each device can both initiate outgoing connections to M other devices and accept incoming connections from N other devices.
This is the default strategy, equivalent to calling the deprecated Connections
API
methods with no Strategy parameter.
In order to advertise with this Strategy, your app must declare the following permissions:
In order to discover with this Strategy, your app must declare all of the above permissions, plus ACCESS_COARSE_LOCATION (Required for devices running M+).
Peer-to-peer strategy that supports a 1-to-1 connection topology. In other words, this enables connecting to a single device within radio range (~100m). This strategy will give the absolute highest bandwidth, but will not allow multiple connections at a time.
In order to advertise with this Strategy, your app must declare the following permissions:
In order to discover with this Strategy, your app must declare all of the above permissions, plus ACCESS_COARSE_LOCATION (Required for devices running M+).
Peer-to-peer strategy that supports a 1-to-N, or star-shaped, connection topology. In other words, this enables connecting devices within radio range (~100m) in a star shape, where each device can, at any given time, play the role of either a hub (where it can accept incoming connections from N other devices), or a spoke (where it can initiate an outgoing connection to a single hub), but not both.
This strategy lends itself best to one device who advertises itself, and N devices who discover that advertisement, though you may still advertise and discover simultaneously if required.
In order to advertise with this Strategy, your app must declare the following permissions:
In order to discover with this Strategy, your app must declare all of the above permissions, plus ACCESS_COARSE_LOCATION (Required for devices running M+).
Parameters | |
---|---|
object |
Object |
Returns | |
---|---|
boolean |
Returns | |
---|---|
int |
Returns | |
---|---|
String |