AI-generated Key Takeaways
-
ConnectionOptions.Builderis a class used to buildConnectionOptionsobjects. -
It includes constructors to create a new builder or to initialize one from an existing
ConnectionOptions. -
Key methods allow setting the connection type, including an option for low power usage.
-
The
setDisruptiveUpgrademethod is deprecated and replaced bysetConnectionType. -
The
buildmethod finalizes the configuration and returns aConnectionOptionsobject.
Builder class for ConnectionOptions.
Public Constructor Summary
|
Builder()
|
|
|
Builder(ConnectionOptions
origin)
|
Public Method Summary
| ConnectionOptions |
build()
|
| ConnectionOptions.Builder |
setConnectionType(int connectionType)
Sets whether the client should disrupt the current connection to optimize the
transfer or not.
|
| ConnectionOptions.Builder |
setDisruptiveUpgrade(boolean disruptiveUpgrade)
This method is deprecated. Use
setConnectionType(int) instead.
|
| ConnectionOptions.Builder |
setLowPower(boolean lowPower)
Sets whether to attempt to connect with the lowest possible power (like BLE) if
true.
|
Inherited Method Summary
Public Constructors
public Builder ()
public Builder (ConnectionOptions origin)
Public Methods
public ConnectionOptions build ()
public ConnectionOptions.Builder setConnectionType (int connectionType)
Sets whether the client should disrupt the current connection to optimize the
transfer or not. The default is
ConnectionType.BALANCED.
public ConnectionOptions.Builder setDisruptiveUpgrade (boolean disruptiveUpgrade)
This method is deprecated.
Use
setConnectionType(int) instead.
Sets the disruptive upgrade flag. A disruptive upgrade may disconnect the device from its primary Wi-Fi network, or otherwise modify Wi-Fi and/or BT state to optimize for faster throughput. By default, this option is true. Set this option to false if the user needs to maintain an internet connection or if the Nearby connection is expected to persist in the background.
public ConnectionOptions.Builder setLowPower (boolean lowPower)
Sets whether to attempt to connect with the lowest possible power (like BLE) if true. By default, this option is false.