Skip to content

Most visited

Recently visited

navigation

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 startAdvertising(AdvertiseSettings, AdvertiseData, AdvertiseCallback) indicating that the advertising has been started successfully.

Inherited methods

From class java.lang.Object

Constants

ADVERTISE_FAILED_ALREADY_STARTED

added in API level 21
int ADVERTISE_FAILED_ALREADY_STARTED

Failed to start advertising as the advertising is already started.

Constant Value: 3 (0x00000003)

ADVERTISE_FAILED_DATA_TOO_LARGE

added in API level 21
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)

ADVERTISE_FAILED_FEATURE_UNSUPPORTED

added in API level 21
int ADVERTISE_FAILED_FEATURE_UNSUPPORTED

This feature is not supported on this platform.

Constant Value: 5 (0x00000005)

ADVERTISE_FAILED_INTERNAL_ERROR

added in API level 21
int ADVERTISE_FAILED_INTERNAL_ERROR

Operation failed due to an internal error.

Constant Value: 4 (0x00000004)

ADVERTISE_FAILED_TOO_MANY_ADVERTISERS

added in API level 21
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
AdvertiseCallback ()

Public methods

onStartFailure

added in API level 21
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
void onStartSuccess (AdvertiseSettings settingsInEffect)

Callback triggered in response to startAdvertising(AdvertiseSettings, AdvertiseData, AdvertiseCallback) 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.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.