# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Methods | Inherited Methods

# BluetoothLeAdvertiser

`public final class BluetoothLeAdvertiser`
`extends Object` ``

java.lang.Object
↳ | android.bluetooth.le.BluetoothLeAdvertiser

This class provides a way to perform Bluetooth LE advertise operations, such as starting and stopping advertising. An advertiser can broadcast up to 31 bytes of advertisement data represented by `AdvertiseData`.

To get an instance of `BluetoothLeAdvertiser`, call the `BluetoothAdapter#getBluetoothLeAdvertiser()` method.

See also:

- `AdvertiseData`

## Summary

### Public methods
`void` | `startAdvertising(AdvertiseSettings settings, AdvertiseData advertiseData, AdvertiseCallback callback)` Start Bluetooth LE Advertising.
`void` | `startAdvertising(AdvertiseSettings settings, AdvertiseData advertiseData, AdvertiseData scanResponse, AdvertiseCallback callback)` Start Bluetooth LE Advertising.
`void` | `startAdvertisingSet(AdvertisingSetParameters parameters, AdvertiseData advertiseData, AdvertiseData scanResponse, PeriodicAdvertisingParameters periodicParameters, AdvertiseData periodicData, int duration, int maxExtendedAdvertisingEvents, AdvertisingSetCallback callback)` Creates a new advertising set.
`void` | `startAdvertisingSet(AdvertisingSetParameters parameters, AdvertiseData advertiseData, AdvertiseData scanResponse, PeriodicAdvertisingParameters periodicParameters, AdvertiseData periodicData, int duration, int maxExtendedAdvertisingEvents, AdvertisingSetCallback callback, Handler handler)` Creates a new advertising set.
`void` | `startAdvertisingSet(AdvertisingSetParameters parameters, AdvertiseData advertiseData, AdvertiseData scanResponse, PeriodicAdvertisingParameters periodicParameters, AdvertiseData periodicData, AdvertisingSetCallback callback)` Creates a new advertising set.
`void` | `startAdvertisingSet(AdvertisingSetParameters parameters, AdvertiseData advertiseData, AdvertiseData scanResponse, PeriodicAdvertisingParameters periodicParameters, AdvertiseData periodicData, AdvertisingSetCallback callback, Handler handler)` Creates a new advertising set.
`void` | `stopAdvertising(AdvertiseCallback callback)` Stop Bluetooth LE advertising.
`void` | `stopAdvertisingSet(AdvertisingSetCallback callback)` Used to dispose of a `AdvertisingSet` object, obtained with `startAdvertisingSet(AdvertisingSetParameters, AdvertiseData, AdvertiseData, PeriodicAdvertisingParameters, AdvertiseData, AdvertisingSetCallback)`.

### Inherited methods
From class `java.lang.Object`
`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 timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Public methods

### startAdvertising

    public void startAdvertising (AdvertiseSettings settings,
                    AdvertiseData advertiseData,
                    AdvertiseCallback callback)

Start Bluetooth LE Advertising. On success, the `advertiseData` will be broadcasted. Returns immediately, the operation status is delivered through `callback`.
For apps targeting `Build.VERSION_CODES#R` or lower, this requires the `Manifest.permission#BLUETOOTH_ADMIN` permission which can be gained with a simple `<uses-permission>` manifest tag.
For apps targeting `Build.VERSION_CODES#S` or or higher, this requires the `Manifest.permission#BLUETOOTH_ADVERTISE` permission which can be gained with `Activity.requestPermissions(String[], int)`.
Requires `Manifest.permission.BLUETOOTH_ADVERTISE`

Parameters
`settings` | `AdvertiseSettings`: Settings for Bluetooth LE advertising.
`advertiseData` | `AdvertiseData`: Advertisement data to be broadcasted.
`callback` | `AdvertiseCallback`: Callback for advertising status.

### startAdvertising

    public void startAdvertising (AdvertiseSettings settings,
                    AdvertiseData advertiseData,
                    AdvertiseData scanResponse,
                    AdvertiseCallback callback)

Start Bluetooth LE Advertising. The `advertiseData` will be broadcasted if the operation succeeds. The `scanResponse` is returned when a scanning device sends an active scan request. This method returns immediately, the operation status is delivered through `callback`.
For apps targeting `Build.VERSION_CODES#R` or lower, this requires the `Manifest.permission#BLUETOOTH_ADMIN` permission which can be gained with a simple `<uses-permission>` manifest tag.
For apps targeting `Build.VERSION_CODES#S` or or higher, this requires the `Manifest.permission#BLUETOOTH_ADVERTISE` permission which can be gained with `Activity.requestPermissions(String[], int)`.
Requires `Manifest.permission.BLUETOOTH_ADVERTISE`

Parameters
`settings` | `AdvertiseSettings`: Settings for Bluetooth LE advertising.
`advertiseData` | `AdvertiseData`: Advertisement data to be advertised in advertisement packet.
`scanResponse` | `AdvertiseData`: Scan response associated with the advertisement data.
`callback` | `AdvertiseCallback`: Callback for advertising status.

### startAdvertisingSet

    public void startAdvertisingSet (AdvertisingSetParameters parameters,
                    AdvertiseData advertiseData,
                    AdvertiseData scanResponse,
                    PeriodicAdvertisingParameters periodicParameters,
                    AdvertiseData periodicData,
                    int duration,
                    int maxExtendedAdvertisingEvents,
                    AdvertisingSetCallback callback)

Creates a new advertising set. If operation succeed, device will start advertising. This method returns immediately, the operation status is delivered through `callback.onAdvertisingSetStarted()`.

For apps targeting `Build.VERSION_CODES#R` or lower, this requires the `Manifest.permission#BLUETOOTH_ADMIN` permission which can be gained with a simple `<uses-permission>` manifest tag.
For apps targeting `Build.VERSION_CODES#S` or or higher, this requires the `Manifest.permission#BLUETOOTH_ADVERTISE` permission which can be gained with `Activity.requestPermissions(String[], int)`.
Requires `Manifest.permission.BLUETOOTH_ADVERTISE`

Parameters
`parameters` | `AdvertisingSetParameters`: advertising set parameters.
`advertiseData` | `AdvertiseData`: Advertisement data to be broadcasted. Size must not exceed `BluetoothAdapter.getLeMaximumAdvertisingDataLength()`. If the advertisement is connectable, three bytes will be added for flags.
`scanResponse` | `AdvertiseData`: Scan response associated with the advertisement data. Size must not exceed `BluetoothAdapter#getLeMaximumAdvertisingDataLength`.
`periodicParameters` | `PeriodicAdvertisingParameters`: periodic advertisng parameters. If null, periodic advertising will not be started.
`periodicData` | `AdvertiseData`: Periodic advertising data. Size must not exceed `BluetoothAdapter.getLeMaximumAdvertisingDataLength()`.
`duration` | `int`: advertising duration, in 10ms unit. Valid range is from 1 (10ms) to 65535 (655,350 ms). 0 means advertising should continue until stopped.
`maxExtendedAdvertisingEvents` | `int`: maximum number of extended advertising events the controller shall attempt to send prior to terminating the extended advertising, even if the duration has not expired. Valid range is from 1 to 255. 0 means no maximum.
`callback` | `AdvertisingSetCallback`: Callback for advertising set.

Throws
`IllegalArgumentException` | when any of the data parameter exceed the maximum allowable size, or unsupported advertising PHY is selected, or when attempt to use Periodic Advertising feature is made when it's not supported by the controller.

### startAdvertisingSet

    public void startAdvertisingSet (AdvertisingSetParameters parameters,
                    AdvertiseData advertiseData,
                    AdvertiseData scanResponse,
                    PeriodicAdvertisingParameters periodicParameters,
                    AdvertiseData periodicData,
                    int duration,
                    int maxExtendedAdvertisingEvents,
                    AdvertisingSetCallback callback,
                    Handler handler)

Creates a new advertising set. If operation succeed, device will start advertising. This method returns immediately, the operation status is delivered through `callback.onAdvertisingSetStarted()`.

For apps targeting `Build.VERSION_CODES#R` or lower, this requires the `Manifest.permission#BLUETOOTH_ADMIN` permission which can be gained with a simple `<uses-permission>` manifest tag.
For apps targeting `Build.VERSION_CODES#S` or or higher, this requires the `Manifest.permission#BLUETOOTH_ADVERTISE` permission which can be gained with `Activity.requestPermissions(String[], int)`.
Requires `Manifest.permission.BLUETOOTH_ADVERTISE`

Parameters
`parameters` | `AdvertisingSetParameters`: Advertising set parameters.
`advertiseData` | `AdvertiseData`: Advertisement data to be broadcasted. Size must not exceed `BluetoothAdapter.getLeMaximumAdvertisingDataLength()`. If the advertisement is connectable, three bytes will be added for flags.
`scanResponse` | `AdvertiseData`: Scan response associated with the advertisement data. Size must not exceed `BluetoothAdapter#getLeMaximumAdvertisingDataLength`
`periodicParameters` | `PeriodicAdvertisingParameters`: Periodic advertisng parameters. If null, periodic advertising will not be started.
`periodicData` | `AdvertiseData`: Periodic advertising data. Size must not exceed `BluetoothAdapter.getLeMaximumAdvertisingDataLength()`
`duration` | `int`: advertising duration, in 10ms unit. Valid range is from 1 (10ms) to 65535 (655,350 ms). 0 means advertising should continue until stopped.
`maxExtendedAdvertisingEvents` | `int`: maximum number of extended advertising events the controller shall attempt to send prior to terminating the extended advertising, even if the duration has not expired. Valid range is from 1 to 255. 0 means no maximum.
`callback` | `AdvertisingSetCallback`: Callback for advertising set.
`handler` | `Handler`: Thread upon which the callbacks will be invoked.

Throws
`IllegalArgumentException` | When any of the data parameter exceed the maximum allowable size, or unsupported advertising PHY is selected, or when attempt to use Periodic Advertising feature is made when it's not supported by the controller, or when maxExtendedAdvertisingEvents is used on a controller that doesn't support the LE Extended Advertising

### startAdvertisingSet

    public void startAdvertisingSet (AdvertisingSetParameters parameters,
                    AdvertiseData advertiseData,
                    AdvertiseData scanResponse,
                    PeriodicAdvertisingParameters periodicParameters,
                    AdvertiseData periodicData,
                    AdvertisingSetCallback callback)

Creates a new advertising set. If operation succeed, device will start advertising. This method returns immediately, the operation status is delivered through `callback.onAdvertisingSetStarted()`.

For apps targeting `Build.VERSION_CODES#R` or lower, this requires the `Manifest.permission#BLUETOOTH_ADMIN` permission which can be gained with a simple `<uses-permission>` manifest tag.
For apps targeting `Build.VERSION_CODES#S` or or higher, this requires the `Manifest.permission#BLUETOOTH_ADVERTISE` permission which can be gained with `Activity.requestPermissions(String[], int)`.
Requires `Manifest.permission.BLUETOOTH_ADVERTISE`

Parameters
`parameters` | `AdvertisingSetParameters`: advertising set parameters.
`advertiseData` | `AdvertiseData`: Advertisement data to be broadcasted. Size must not exceed `BluetoothAdapter.getLeMaximumAdvertisingDataLength()`. If the advertisement is connectable, three bytes will be added for flags.
`scanResponse` | `AdvertiseData`: Scan response associated with the advertisement data. Size must not exceed `BluetoothAdapter#getLeMaximumAdvertisingDataLength`.
`periodicParameters` | `PeriodicAdvertisingParameters`: periodic advertisng parameters. If null, periodic advertising will not be started.
`periodicData` | `AdvertiseData`: Periodic advertising data. Size must not exceed `BluetoothAdapter.getLeMaximumAdvertisingDataLength()`.
`callback` | `AdvertisingSetCallback`: Callback for advertising set.

Throws
`IllegalArgumentException` | when any of the data parameter exceed the maximum allowable size, or unsupported advertising PHY is selected, or when attempt to use Periodic Advertising feature is made when it's not supported by the controller.

### startAdvertisingSet

    public void startAdvertisingSet (AdvertisingSetParameters parameters,
                    AdvertiseData advertiseData,
                    AdvertiseData scanResponse,
                    PeriodicAdvertisingParameters periodicParameters,
                    AdvertiseData periodicData,
                    AdvertisingSetCallback callback,
                    Handler handler)

Creates a new advertising set. If operation succeed, device will start advertising. This method returns immediately, the operation status is delivered through `callback.onAdvertisingSetStarted()`.

For apps targeting `Build.VERSION_CODES#R` or lower, this requires the `Manifest.permission#BLUETOOTH_ADMIN` permission which can be gained with a simple `<uses-permission>` manifest tag.
For apps targeting `Build.VERSION_CODES#S` or or higher, this requires the `Manifest.permission#BLUETOOTH_ADVERTISE` permission which can be gained with `Activity.requestPermissions(String[], int)`.
Requires `Manifest.permission.BLUETOOTH_ADVERTISE`

Parameters
`parameters` | `AdvertisingSetParameters`: advertising set parameters.
`advertiseData` | `AdvertiseData`: Advertisement data to be broadcasted. Size must not exceed `BluetoothAdapter.getLeMaximumAdvertisingDataLength()`. If the advertisement is connectable, three bytes will be added for flags.
`scanResponse` | `AdvertiseData`: Scan response associated with the advertisement data. Size must not exceed `BluetoothAdapter#getLeMaximumAdvertisingDataLength`.
`periodicParameters` | `PeriodicAdvertisingParameters`: periodic advertisng parameters. If null, periodic advertising will not be started.
`periodicData` | `AdvertiseData`: Periodic advertising data. Size must not exceed `BluetoothAdapter.getLeMaximumAdvertisingDataLength()`.
`callback` | `AdvertisingSetCallback`: Callback for advertising set.
`handler` | `Handler`: thread upon which the callbacks will be invoked.

Throws
`IllegalArgumentException` | when any of the data parameter exceed the maximum allowable size, or unsupported advertising PHY is selected, or when attempt to use Periodic Advertising feature is made when it's not supported by the controller.

### stopAdvertising

    public void stopAdvertising (AdvertiseCallback callback)

Stop Bluetooth LE advertising. The `callback` must be the same one use in `BluetoothLeAdvertiser#startAdvertising`.
For apps targeting `Build.VERSION_CODES#R` or lower, this requires the `Manifest.permission#BLUETOOTH_ADMIN` permission which can be gained with a simple `<uses-permission>` manifest tag.
For apps targeting `Build.VERSION_CODES#S` or or higher, this requires the `Manifest.permission#BLUETOOTH_ADVERTISE` permission which can be gained with `Activity.requestPermissions(String[], int)`.
Requires `Manifest.permission.BLUETOOTH_ADVERTISE`

Parameters
`callback` | `AdvertiseCallback`: `AdvertiseCallback` identifies the advertising instance to stop.

### stopAdvertisingSet

    public void stopAdvertisingSet (AdvertisingSetCallback callback)

Used to dispose of a `AdvertisingSet` object, obtained with `startAdvertisingSet(AdvertisingSetParameters, AdvertiseData, AdvertiseData, PeriodicAdvertisingParameters, AdvertiseData, AdvertisingSetCallback)`.
For apps targeting `Build.VERSION_CODES#R` or lower, this requires the `Manifest.permission#BLUETOOTH_ADMIN` permission which can be gained with a simple `<uses-permission>` manifest tag.
For apps targeting `Build.VERSION_CODES#S` or or higher, this requires the `Manifest.permission#BLUETOOTH_ADVERTISE` permission which can be gained with `Activity.requestPermissions(String[], int)`.
Requires `Manifest.permission.BLUETOOTH_ADVERTISE`

Parameters
`callback` | `AdvertisingSetCallback`

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*