AdvertiseParams


class AdvertiseParams


A class to provide a way to adjust advertising preferences and advertise data packet.

Summary

Public constructors

AdvertiseParams(
    shouldIncludeDeviceAddress: Boolean,
    shouldIncludeDeviceName: Boolean,
    isConnectable: Boolean,
    isDiscoverable: Boolean,
    durationMillis: @IntRange(from = 0, to = 180000) Long,
    manufacturerData: Map<IntByteArray>,
    serviceData: Map<UUIDByteArray>,
    serviceUuids: List<UUID>,
    serviceSolicitationUuids: List<UUID>
)

Public properties

Long

Advertising duration in milliseconds.

Boolean

Whether the advertisement will indicate connectable.

Boolean

Whether the advertisement will be discoverable.

Map<IntByteArray>

A map of company identifiers to manufacturer specific data.

Map<UUIDByteArray>

A map of 16-bit UUIDs of the services to corresponding additional service data.

List<UUID>

A list of service solicitation UUIDs to advertise that we invite to connect.

List<UUID>

A list of service UUIDs to advertise.

Boolean

Whether the device address will be included in the advertisement packet.

Boolean

Whether the device name will be included in the advertisement packet.

Public constructors

AdvertiseParams

Added in 1.0.0-alpha02
AdvertiseParams(
    shouldIncludeDeviceAddress: Boolean = false,
    shouldIncludeDeviceName: Boolean = false,
    isConnectable: Boolean = false,
    isDiscoverable: Boolean = false,
    durationMillis: @IntRange(from = 0, to = 180000) Long = 0,
    manufacturerData: Map<IntByteArray> = emptyMap(),
    serviceData: Map<UUIDByteArray> = emptyMap(),
    serviceUuids: List<UUID> = emptyList(),
    serviceSolicitationUuids: List<UUID> = emptyList()
)

Public properties

durationMillis

Added in 1.0.0-alpha02
val durationMillisLong

Advertising duration in milliseconds.

It must not exceed 180000 milliseconds. A value of 0 means advertising continues until it is stopped explicitly.

Throws
kotlin.IllegalArgumentException

if it is not in the range 0..180000.

isConnectable

Added in 1.0.0-alpha02
val isConnectableBoolean

Whether the advertisement will indicate connectable.

isDiscoverable

Added in 1.0.0-alpha02
val isDiscoverableBoolean

Whether the advertisement will be discoverable.

Please note that it would be ignored under API level 34 and isConnectable would be used instead.

manufacturerData

Added in 1.0.0-alpha02
val manufacturerDataMap<IntByteArray>

A map of company identifiers to manufacturer specific data.

Please refer to the Bluetooth Assigned Numbers document provided by the Bluetooth SIG for the list of existing company identifiers.

serviceData

Added in 1.0.0-alpha02
val serviceDataMap<UUIDByteArray>

A map of 16-bit UUIDs of the services to corresponding additional service data.

serviceSolicitationUuids

Added in 1.0.0-alpha02
val serviceSolicitationUuidsList<UUID>

A list of service solicitation UUIDs to advertise that we invite to connect.

serviceUuids

Added in 1.0.0-alpha02
val serviceUuidsList<UUID>

A list of service UUIDs to advertise.

shouldIncludeDeviceAddress

val shouldIncludeDeviceAddressBoolean

Whether the device address will be included in the advertisement packet.

shouldIncludeDeviceName

val shouldIncludeDeviceNameBoolean

Whether the device name will be included in the advertisement packet.