AdvertisingOptions.Builder

Stay organized with collections Save and categorize content based on your preferences.
public static final class AdvertisingOptions.Builder extends Object

Builder class for AdvertisingOptions.

Public Constructor Summary

Builder()
Creates a builder using the default advertising options.
Builder(AdvertisingOptions origin)
Creates a builder, copying the provided advertising options.

Public Method Summary

AdvertisingOptions
AdvertisingOptions.Builder
setConnectionType(int connectionType)
Sets whether the client should disrupt the current connection to optimize the transfer or not.
AdvertisingOptions.Builder
setDisruptiveUpgrade(boolean disruptiveUpgrade)
This method is deprecated. Use setConnectionType(int) instead.
AdvertisingOptions.Builder
setLowPower(boolean lowPower)
Sets whether low power should be used.
AdvertisingOptions.Builder
setStrategy(Strategy strategy)
Sets the advertising strategy.

Inherited Method Summary

Public Constructors

public Builder ()

Creates a builder using the default advertising options.

public Builder (AdvertisingOptions origin)

Creates a builder, copying the provided advertising options.

Public Methods

public AdvertisingOptions build ()

public AdvertisingOptions.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 AdvertisingOptions.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 AdvertisingOptions.Builder setLowPower (boolean lowPower)

Sets whether low power should be used. If true, only low power mediums (like BLE) will be used for advertising. By default, this option is false.

public AdvertisingOptions.Builder setStrategy (Strategy strategy)

Sets the advertising strategy. The strategy used for advertising must match the strategy used in DiscoveryOptions.