# AdvertiseCallback

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Constants](https://developer.android.com/reference/android/bluetooth/le/AdvertiseCallback#constants)\|[Ctors](https://developer.android.com/reference/android/bluetooth/le/AdvertiseCallback#pubctors)\|[Methods](https://developer.android.com/reference/android/bluetooth/le/AdvertiseCallback#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/bluetooth/le/AdvertiseCallback#inhmethods)  

# AdvertiseCallback

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/bluetooth/le/AdvertiseCallback "View this page in Kotlin")\|Java

`
public


abstract
class
AdvertiseCallback
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|----------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.bluetooth.le.AdvertiseCallback |

<br />

*** ** * ** ***

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

## Summary

|                                                                                                                     ### Constants                                                                                                                     ||
|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [ADVERTISE_FAILED_ALREADY_STARTED](https://developer.android.com/reference/android/bluetooth/le/AdvertiseCallback#ADVERTISE_FAILED_ALREADY_STARTED) Failed to start advertising as the advertising is already started.                         |
| `int` | [ADVERTISE_FAILED_DATA_TOO_LARGE](https://developer.android.com/reference/android/bluetooth/le/AdvertiseCallback#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](https://developer.android.com/reference/android/bluetooth/le/AdvertiseCallback#ADVERTISE_FAILED_FEATURE_UNSUPPORTED) This feature is not supported on this platform.                                    |
| `int` | [ADVERTISE_FAILED_INTERNAL_ERROR](https://developer.android.com/reference/android/bluetooth/le/AdvertiseCallback#ADVERTISE_FAILED_INTERNAL_ERROR) Operation failed due to an internal error.                                                   |
| `int` | [ADVERTISE_FAILED_TOO_MANY_ADVERTISERS](https://developer.android.com/reference/android/bluetooth/le/AdvertiseCallback#ADVERTISE_FAILED_TOO_MANY_ADVERTISERS) Failed to start advertising because no advertising instance is available.        |

|                                                      ### Public constructors                                                       ||
|---------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[AdvertiseCallback](https://developer.android.com/reference/android/bluetooth/le/AdvertiseCallback#AdvertiseCallback())`() ` |

|                                                                                                                                                                                                                                                                                                                         ### Public methods                                                                                                                                                                                                                                                                                                                          ||
|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void` | ` `[onStartFailure](https://developer.android.com/reference/android/bluetooth/le/AdvertiseCallback#onStartFailure(int))`(int errorCode) ` Callback when advertising could not be started.                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` void` | ` `[onStartSuccess](https://developer.android.com/reference/android/bluetooth/le/AdvertiseCallback#onStartSuccess(android.bluetooth.le.AdvertiseSettings))`(`[AdvertiseSettings](https://developer.android.com/reference/android/bluetooth/le/AdvertiseSettings)` settingsInEffect) ` Callback triggered in response to[BluetoothLeAdvertiser.startAdvertising](https://developer.android.com/reference/android/bluetooth/le/BluetoothLeAdvertiser#startAdvertising(android.bluetooth.le.AdvertiseSettings,%20android.bluetooth.le.AdvertiseData,%20android.bluetooth.le.AdvertiseCallback))indicating that the advertising has been started successfully. |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(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](https://developer.android.com/reference/java/lang/Object#wait(long))`(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](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Constants

### ADVERTISE_FAILED_ALREADY_STARTED

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int ADVERTISE_FAILED_ALREADY_STARTED
```

Failed to start advertising as the advertising is already started.

<br />

Constant Value: 3 (0x00000003)  

### ADVERTISE_FAILED_DATA_TOO_LARGE

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
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.

<br />

Constant Value: 1 (0x00000001)  

### ADVERTISE_FAILED_FEATURE_UNSUPPORTED

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int ADVERTISE_FAILED_FEATURE_UNSUPPORTED
```

This feature is not supported on this platform.

<br />

Constant Value: 5 (0x00000005)  

### ADVERTISE_FAILED_INTERNAL_ERROR

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int ADVERTISE_FAILED_INTERNAL_ERROR
```

Operation failed due to an internal error.

<br />

Constant Value: 4 (0x00000004)  

### ADVERTISE_FAILED_TOO_MANY_ADVERTISERS

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int ADVERTISE_FAILED_TOO_MANY_ADVERTISERS
```

Failed to start advertising because no advertising instance is available.

<br />

Constant Value: 2 (0x00000002)

## Public constructors

### AdvertiseCallback

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public AdvertiseCallback ()
```

<br />

<br />

## Public methods

### onStartFailure

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void onStartFailure (int errorCode)
```

Callback when advertising could not be started.

<br />

|                                                Parameters                                                 ||
|-------------|----------------------------------------------------------------------------------------------|
| `errorCode` | `int`: Error code (see ADVERTISE_FAILED_\* constants) for advertising start failures. <br /> |

### onStartSuccess

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void onStartSuccess (AdvertiseSettings settingsInEffect)
```

Callback triggered in response to[BluetoothLeAdvertiser.startAdvertising](https://developer.android.com/reference/android/bluetooth/le/BluetoothLeAdvertiser#startAdvertising(android.bluetooth.le.AdvertiseSettings,%20android.bluetooth.le.AdvertiseData,%20android.bluetooth.le.AdvertiseCallback))indicating that the advertising has been started successfully.

<br />

|                                                                   Parameters                                                                   ||
|--------------------|----------------------------------------------------------------------------------------------------------------------------|
| `settingsInEffect` | `AdvertiseSettings`: The actual settings used for advertising, which may be different from what has been requested. <br /> |