AdvertiseCallback


public abstract class AdvertiseCallback
extends Object

java.lang.Object
   ↳ android.bluetooth.le.AdvertiseCallback


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

Summary

Constants

int ADVERTISE_FAILED_ALREADY_STARTED

Failed to start advertising as the advertising is already started.

int ADVERTISE_FAILED_DATA_TOO_LARGE

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

int ADVERTISE_FAILED_FEATURE_UNSUPPORTED

This feature is not supported on this platform.

int ADVERTISE_FAILED_INTERNAL_ERROR

Operation failed due to an internal error.

int ADVERTISE_FAILED_TOO_MANY_ADVERTISERS

Failed to start advertising because no advertising instance is available.

Public constructors

AdvertiseCallback()

Public methods

void onStartFailure(int errorCode)

Callback when advertising could not be started.

void onStartSuccess(AdvertiseSettings settingsInEffect)

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

Inherited methods

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Constants

Added in API level 21
public static final int ADVERTISE_FAILED_ALREADY_STARTED

Failed to start advertising as the advertising is already started.

Constant Value: 3 (0x00000003)

Added in API level 21
public static final int ADVERTISE_FAILED_DATA_TOO_LARGE

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

Constant Value: 1 (0x00000001)

Added in API level 21
public static final int ADVERTISE_FAILED_FEATURE_UNSUPPORTED

This feature is not supported on this platform.

Constant Value: 5 (0x00000005)

Added in API level 21
public static final int ADVERTISE_FAILED_INTERNAL_ERROR

Operation failed due to an internal error.

Constant Value: 4 (0x00000004)

Added in API level 21
public static final int ADVERTISE_FAILED_TOO_MANY_ADVERTISERS

Failed to start advertising because no advertising instance is available.

Constant Value: 2 (0x00000002)

Public constructors

AdvertiseCallback

Added in API level 21
public AdvertiseCallback ()

Public methods

onStartFailure

Added in API level 21
public void onStartFailure (int errorCode)

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
public void onStartSuccess (AdvertiseSettings settingsInEffect)

Callback triggered in response to 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.