Most visited

Recently visited

Added in API level 21

AdvertiseCallback

public abstract class AdvertiseCallback
extends Object

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


蓝牙LE广告回调,用于提供广告运营状态。

Summary

Constants

int ADVERTISE_FAILED_ALREADY_STARTED

由于广告已经开始,因此无法开始投放广告。

int ADVERTISE_FAILED_DATA_TOO_LARGE

由于要广播的广告数据大于31个字节,因此无法开始广告。

int ADVERTISE_FAILED_FEATURE_UNSUPPORTED

此平台不支持此功能。

int ADVERTISE_FAILED_INTERNAL_ERROR

由于内部错误,操作失败。

int ADVERTISE_FAILED_TOO_MANY_ADVERTISERS

无法开始投放广告,因为没有可用的广告实例。

Public constructors

AdvertiseCallback()

Public methods

void onStartFailure(int errorCode)

广告无法启动时回调。

void onStartSuccess(AdvertiseSettings settingsInEffect)

响应 startAdvertising(AdvertiseSettings, AdvertiseData, AdvertiseCallback)触发的回叫表示广告已成功启动。

Inherited methods

From class java.lang.Object

Constants

ADVERTISE_FAILED_ALREADY_STARTED

Added in API level 21
int ADVERTISE_FAILED_ALREADY_STARTED

由于广告已经开始,因此无法开始投放广告。

常量值:3(0x00000003)

ADVERTISE_FAILED_DATA_TOO_LARGE

Added in API level 21
int ADVERTISE_FAILED_DATA_TOO_LARGE

由于要广播的广告数据大于31个字节,因此无法开始广告。

常数值:1(0x00000001)

ADVERTISE_FAILED_FEATURE_UNSUPPORTED

Added in API level 21
int ADVERTISE_FAILED_FEATURE_UNSUPPORTED

此平台不支持此功能。

常量值:5(0x00000005)

ADVERTISE_FAILED_INTERNAL_ERROR

Added in API level 21
int ADVERTISE_FAILED_INTERNAL_ERROR

由于内部错误,操作失败。

常量值:4(0x00000004)

ADVERTISE_FAILED_TOO_MANY_ADVERTISERS

Added in API level 21
int ADVERTISE_FAILED_TOO_MANY_ADVERTISERS

无法开始投放广告,因为没有可用的广告实例。

常量值:2(0x00000002)

Public constructors

AdvertiseCallback

Added in API level 21
AdvertiseCallback ()

Public methods

onStartFailure

Added in API level 21
void onStartFailure (int errorCode)

广告无法启动时回调。

Parameters
errorCode int: Error code (see ADVERTISE_FAILED_* constants) for advertising start failures.

onStartSuccess

Added in API level 21
void onStartSuccess (AdvertiseSettings settingsInEffect)

响应 startAdvertising(AdvertiseSettings, AdvertiseData, AdvertiseCallback)触发的 startAdvertising(AdvertiseSettings, AdvertiseData, AdvertiseCallback)表示广告已成功启动。

Parameters
settingsInEffect AdvertiseSettings: The actual settings used for advertising, which may be different from what has been requested.

Hooray!