Added in API level 21

AdvertiseCallback


abstract class AdvertiseCallback
kotlin.Any
   ↳ android.bluetooth.le.AdvertiseCallback

Bluetooth LE advertising callbacks, used to deliver advertising operation status.

Summary

Constants
static Int

Failed to start advertising as the advertising is already started.

static Int

Failed to start advertising as the advertise data to be broadcasted is larger than 31 bytes.

static Int

This feature is not supported on this platform.

static Int

Operation failed due to an internal error.

static Int

Failed to start advertising because no advertising instance is available.

Public constructors

Public methods
open Unit
onStartFailure(errorCode: Int)

Callback when advertising could not be started.

open Unit
onStartSuccess(settingsInEffect: AdvertiseSettings!)

Callback triggered in response to android.

Constants

Added in API level 21
static val ADVERTISE_FAILED_ALREADY_STARTED: Int

Failed to start advertising as the advertising is already started.

Value: 3
Added in API level 21
static val ADVERTISE_FAILED_DATA_TOO_LARGE: Int

Failed to start advertising as the advertise data to be broadcasted is larger than 31 bytes.

Value: 1
Added in API level 21
static val ADVERTISE_FAILED_FEATURE_UNSUPPORTED: Int

This feature is not supported on this platform.

Value: 5
Added in API level 21
static val ADVERTISE_FAILED_INTERNAL_ERROR: Int

Operation failed due to an internal error.

Value: 4
Added in API level 21
static val ADVERTISE_FAILED_TOO_MANY_ADVERTISERS: Int

Failed to start advertising because no advertising instance is available.

Value: 2

Public constructors

AdvertiseCallback

Added in API level 21
AdvertiseCallback()

Public methods

onStartFailure

Added in API level 21
open fun onStartFailure(errorCode: Int): Unit

Callback when advertising could not be started.

Parameters
errorCode Int: Error code (see ADVERTISE_FAILED_* constants) for advertising start failures.

onStartSuccess

Added in API level 21
open fun onStartSuccess(settingsInEffect: AdvertiseSettings!): Unit

Callback triggered in response to android.bluetooth.le.BluetoothLeAdvertiser#startAdvertising indicating that the advertising has been started successfully.

Parameters
settingsInEffect AdvertiseSettings!: The actual settings used for advertising, which may be different from what has been requested.