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/ScanCallback#constants) \| [Ctors](https://developer.android.com/reference/android/bluetooth/le/ScanCallback#pubctors) \| [Methods](https://developer.android.com/reference/android/bluetooth/le/ScanCallback#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/bluetooth/le/ScanCallback#inhmethods)

# ScanCallback

*** ** * ** ***

` public abstract class ScanCallback `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

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

<br />

*** ** * ** ***

Bluetooth LE scan callbacks. Scan results are reported using these callbacks.
**See also:**

- `https://developer.android.com/reference/android/bluetooth/le/BluetoothLeScanner#startScan(android.bluetooth.le.ScanCallback)`

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/bluetooth/le/ScanCallback#SCAN_FAILED_ALREADY_STARTED` Fails to start scan as BLE scan with the same settings is already started by the app. |
| `int` | `https://developer.android.com/reference/android/bluetooth/le/ScanCallback#SCAN_FAILED_APPLICATION_REGISTRATION_FAILED` Fails to start scan as app cannot be registered. |
| `int` | `https://developer.android.com/reference/android/bluetooth/le/ScanCallback#SCAN_FAILED_FEATURE_UNSUPPORTED` Fails to start power optimized scan as this feature is not supported. |
| `int` | `https://developer.android.com/reference/android/bluetooth/le/ScanCallback#SCAN_FAILED_INTERNAL_ERROR` Fails to start scan due an internal error |
| `int` | `https://developer.android.com/reference/android/bluetooth/le/ScanCallback#SCAN_FAILED_OUT_OF_HARDWARE_RESOURCES` Fails to start scan as it is out of hardware resources. |
| `int` | `https://developer.android.com/reference/android/bluetooth/le/ScanCallback#SCAN_FAILED_SCANNING_TOO_FREQUENTLY` Fails to start scan as application tries to scan too frequently. |

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

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/bluetooth/le/ScanCallback#onBatchScanResults(java.util.List<android.bluetooth.le.ScanResult>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/bluetooth/le/ScanResult> results) ` Callback when batch results are delivered. |
| ` void` | ` https://developer.android.com/reference/android/bluetooth/le/ScanCallback#onScanFailed(int)(int errorCode) ` Callback when scan could not be started. |
| ` void` | ` https://developer.android.com/reference/android/bluetooth/le/ScanCallback#onScanResult(int,%20android.bluetooth.le.ScanResult)(int callbackType, https://developer.android.com/reference/android/bluetooth/le/ScanResult result) ` Callback when a BLE advertisement has been found. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` 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 https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` 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` ` 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` ` 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

### SCAN_FAILED_ALREADY_STARTED

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

```
public static final int SCAN_FAILED_ALREADY_STARTED
```

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

<br />

Constant Value: 1 (0x00000001)

### SCAN_FAILED_APPLICATION_REGISTRATION_FAILED

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

```
public static final int SCAN_FAILED_APPLICATION_REGISTRATION_FAILED
```

Fails to start scan as app cannot be registered.

<br />

Constant Value: 2 (0x00000002)

### SCAN_FAILED_FEATURE_UNSUPPORTED

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

```
public static final int SCAN_FAILED_FEATURE_UNSUPPORTED
```

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

<br />

Constant Value: 4 (0x00000004)

### SCAN_FAILED_INTERNAL_ERROR

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

```
public static final int SCAN_FAILED_INTERNAL_ERROR
```

Fails to start scan due an internal error

<br />

Constant Value: 3 (0x00000003)

### SCAN_FAILED_OUT_OF_HARDWARE_RESOURCES

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

```
public static final int SCAN_FAILED_OUT_OF_HARDWARE_RESOURCES
```

Fails to start scan as it is out of hardware resources.

<br />

Constant Value: 5 (0x00000005)

### SCAN_FAILED_SCANNING_TOO_FREQUENTLY

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

```
public static final int SCAN_FAILED_SCANNING_TOO_FREQUENTLY
```

Fails to start scan as application tries to scan too frequently.

<br />

Constant Value: 6 (0x00000006)

## Public constructors

### ScanCallback

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

```
public ScanCallback ()
```

<br />

<br />

## Public methods

### onBatchScanResults

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

```
public void onBatchScanResults (List<ScanResult> results)
```

Callback when batch results are delivered.

<br />

| Parameters ||
|---|---|
| `results` | `List`: List of scan results that are previously scanned. <br /> |

### onScanFailed

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

```
public void onScanFailed (int errorCode)
```

Callback when scan could not be started.

<br />

| Parameters ||
|---|---|
| `errorCode` | `int`: Error code (one of SCAN_FAILED_\*) for scan failure. Value is one of the following: - `https://developer.android.com/reference/android/bluetooth/le/ScanCallback#SCAN_FAILED_ALREADY_STARTED` - `https://developer.android.com/reference/android/bluetooth/le/ScanCallback#SCAN_FAILED_APPLICATION_REGISTRATION_FAILED` - `https://developer.android.com/reference/android/bluetooth/le/ScanCallback#SCAN_FAILED_INTERNAL_ERROR` - `https://developer.android.com/reference/android/bluetooth/le/ScanCallback#SCAN_FAILED_FEATURE_UNSUPPORTED` - `https://developer.android.com/reference/android/bluetooth/le/ScanCallback#SCAN_FAILED_OUT_OF_HARDWARE_RESOURCES` - `https://developer.android.com/reference/android/bluetooth/le/ScanCallback#SCAN_FAILED_SCANNING_TOO_FREQUENTLY` |

### onScanResult

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

```
public void onScanResult (int callbackType, 
                ScanResult result)
```

Callback when a BLE advertisement has been found.

<br />

| Parameters ||
|---|---|
| `callbackType` | `int`: Determines how this callback was triggered. Could be one of `https://developer.android.com/reference/android/bluetooth/le/ScanSettings#CALLBACK_TYPE_ALL_MATCHES`, `https://developer.android.com/reference/android/bluetooth/le/ScanSettings#CALLBACK_TYPE_FIRST_MATCH` or `https://developer.android.com/reference/android/bluetooth/le/ScanSettings#CALLBACK_TYPE_MATCH_LOST` <br /> |
| `result` | `ScanResult`: A Bluetooth LE scan result. <br /> |