Android APIs
public abstract class

AdvertiseCallback

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

Class Overview

Callback of Bluetooth LE advertising, which is used to deliver advertising operation status.

Summary

Constants
int ADVERTISE_FAILED_ALREADY_STARTED Fails to start advertising as the advertising is already started.
int ADVERTISE_FAILED_CONTROLLER_FAILURE Operation fails due to bluetooth controller failure.
int ADVERTISE_FAILED_NOT_STARTED Fails to stop advertising as the advertising is not started.
int ADVERTISE_FAILED_SERVICE_UNKNOWN Fails to start advertising as the advertisement data contains services that are not added to the local bluetooth GATT server.
int ADVERTISE_FAILED_TOO_MANY_ADVERTISERS Fails to start advertising as system runs out of quota for advertisers.
Public Constructors
AdvertiseCallback()
Public Methods
abstract void onFailure(int errorCode)
Callback when advertising operation fails.
abstract void onSuccess(AdvertiseSettings settingsInEffect)
Callback when advertising operation succeeds.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int ADVERTISE_FAILED_ALREADY_STARTED

Fails to start advertising as the advertising is already started.

Constant Value: 3 (0x00000003)

public static final int ADVERTISE_FAILED_CONTROLLER_FAILURE

Operation fails due to bluetooth controller failure.

Constant Value: 5 (0x00000005)

public static final int ADVERTISE_FAILED_NOT_STARTED

Fails to stop advertising as the advertising is not started.

Constant Value: 4 (0x00000004)

public static final int ADVERTISE_FAILED_SERVICE_UNKNOWN

Fails to start advertising as the advertisement data contains services that are not added to the local bluetooth GATT server.

Constant Value: 1 (0x00000001)

public static final int ADVERTISE_FAILED_TOO_MANY_ADVERTISERS

Fails to start advertising as system runs out of quota for advertisers.

Constant Value: 2 (0x00000002)

Public Constructors

public AdvertiseCallback ()

Public Methods

public abstract void onFailure (int errorCode)

Callback when advertising operation fails.

Parameters
errorCode Error code for failures.

public abstract void onSuccess (AdvertiseSettings settingsInEffect)

Callback when advertising operation succeeds.

Parameters
settingsInEffect The actual settings used for advertising, which may be different from what the app asks.