Android APIs
public abstract class

ScanCallback

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

Class Overview

Bluetooth LE scan callbacks. Scan results are reported using these callbacks.

Summary

Constants
int SCAN_FAILED_ALREADY_STARTED Fails to start scan as BLE scan with the same settings is already started by the app.
int SCAN_FAILED_APPLICATION_REGISTRATION_FAILED Fails to start scan as app cannot be registered.
int SCAN_FAILED_FEATURE_UNSUPPORTED Fails to start power optimized scan as this feature is not supported.
int SCAN_FAILED_INTERNAL_ERROR Fails to start scan due an internal error
Public Constructors
ScanCallback()
Public Methods
void onBatchScanResults(List<ScanResult> results)
Callback when batch results are delivered.
void onScanFailed(int errorCode)
Callback when scan could not be started.
void onScanResult(int callbackType, ScanResult result)
Callback when a BLE advertisement has been found.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int SCAN_FAILED_ALREADY_STARTED

Added in API level 21

Fails to start scan as BLE scan with the same settings is already started by the app.

Constant Value: 1 (0x00000001)

public static final int SCAN_FAILED_APPLICATION_REGISTRATION_FAILED

Added in API level 21

Fails to start scan as app cannot be registered.

Constant Value: 2 (0x00000002)

public static final int SCAN_FAILED_FEATURE_UNSUPPORTED

Added in API level 21

Fails to start power optimized scan as this feature is not supported.

Constant Value: 4 (0x00000004)

public static final int SCAN_FAILED_INTERNAL_ERROR

Added in API level 21

Fails to start scan due an internal error

Constant Value: 3 (0x00000003)

Public Constructors

public ScanCallback ()

Added in API level 21

Public Methods

public void onBatchScanResults (List<ScanResult> results)

Added in API level 21

Callback when batch results are delivered.

Parameters
results List of scan results that are previously scanned.

public void onScanFailed (int errorCode)

Added in API level 21

Callback when scan could not be started.

Parameters
errorCode Error code (one of SCAN_FAILED_*) for scan failure.

public void onScanResult (int callbackType, ScanResult result)

Added in API level 21

Callback when a BLE advertisement has been found.

Parameters
callbackType Determines how this callback was triggered. Currently could only be CALLBACK_TYPE_ALL_MATCHES.
result A Bluetooth LE scan result.