Android APIs
public final class

ScanSettings

extends Object
implements Parcelable
java.lang.Object
   ↳ android.bluetooth.le.ScanSettings

Class Overview

Bluetooth LE scan settings are passed to startScan(ScanCallback) to define the parameters for the scan.

Summary

Nested Classes
class ScanSettings.Builder Builder for ScanSettings
Constants
int CALLBACK_TYPE_ALL_MATCHES Trigger a callback for every Bluetooth advertisement found that matches the filter criteria.
int CALLBACK_TYPE_FIRST_MATCH A result callback is only triggered for the first advertisement packet received that matches the filter criteria.
int CALLBACK_TYPE_MATCH_LOST Receive a callback when advertisements are no longer received from a device that has been previously reported by a first match callback.
int MATCH_MODE_AGGRESSIVE In Aggressive mode, hw will determine a match sooner even with feeble signal strength and few number of sightings/match in a duration.
int MATCH_MODE_STICKY For sticky mode, higher threshold of signal strength and sightings is required before reporting by hw
int MATCH_NUM_FEW_ADVERTISEMENT Match few advertisement per filter, depends on current capability and availibility of the resources in hw
int MATCH_NUM_MAX_ADVERTISEMENT Match as many advertisement per filter as hw could allow, depends on current capability and availibility of the resources in hw
int MATCH_NUM_ONE_ADVERTISEMENT Match one advertisement per filter
int SCAN_MODE_BALANCED Perform Bluetooth LE scan in balanced power mode.
int SCAN_MODE_LOW_LATENCY Scan using highest duty cycle.
int SCAN_MODE_LOW_POWER Perform Bluetooth LE scan in low power mode.
int SCAN_MODE_OPPORTUNISTIC A special Bluetooth LE scan mode.
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<ScanSettings> CREATOR
Public Methods
int describeContents()
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
int getCallbackType()
long getReportDelayMillis()
Returns report delay timestamp based on the device clock.
int getScanMode()
int getScanResultType()
void writeToParcel(Parcel dest, int flags)
Flatten this object in to a Parcel.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Constants

public static final int CALLBACK_TYPE_ALL_MATCHES

Added in API level 21

Trigger a callback for every Bluetooth advertisement found that matches the filter criteria. If no filter is active, all advertisement packets are reported.

Constant Value: 1 (0x00000001)

public static final int CALLBACK_TYPE_FIRST_MATCH

Added in API level 23

A result callback is only triggered for the first advertisement packet received that matches the filter criteria.

Constant Value: 2 (0x00000002)

public static final int CALLBACK_TYPE_MATCH_LOST

Added in API level 23

Receive a callback when advertisements are no longer received from a device that has been previously reported by a first match callback.

Constant Value: 4 (0x00000004)

public static final int MATCH_MODE_AGGRESSIVE

Added in API level 23

In Aggressive mode, hw will determine a match sooner even with feeble signal strength and few number of sightings/match in a duration.

Constant Value: 1 (0x00000001)

public static final int MATCH_MODE_STICKY

Added in API level 23

For sticky mode, higher threshold of signal strength and sightings is required before reporting by hw

Constant Value: 2 (0x00000002)

public static final int MATCH_NUM_FEW_ADVERTISEMENT

Added in API level 23

Match few advertisement per filter, depends on current capability and availibility of the resources in hw

Constant Value: 2 (0x00000002)

public static final int MATCH_NUM_MAX_ADVERTISEMENT

Added in API level 23

Match as many advertisement per filter as hw could allow, depends on current capability and availibility of the resources in hw

Constant Value: 3 (0x00000003)

public static final int MATCH_NUM_ONE_ADVERTISEMENT

Added in API level 23

Match one advertisement per filter

Constant Value: 1 (0x00000001)

public static final int SCAN_MODE_BALANCED

Added in API level 21

Perform Bluetooth LE scan in balanced power mode. Scan results are returned at a rate that provides a good trade-off between scan frequency and power consumption.

Constant Value: 1 (0x00000001)

public static final int SCAN_MODE_LOW_LATENCY

Added in API level 21

Scan using highest duty cycle. It's recommended to only use this mode when the application is running in the foreground.

Constant Value: 2 (0x00000002)

public static final int SCAN_MODE_LOW_POWER

Added in API level 21

Perform Bluetooth LE scan in low power mode. This is the default scan mode as it consumes the least power.

Constant Value: 0 (0x00000000)

public static final int SCAN_MODE_OPPORTUNISTIC

Added in API level 23

A special Bluetooth LE scan mode. Applications using this scan mode will passively listen for other scan results without starting BLE scans themselves.

Constant Value: -1 (0xffffffff)

Fields

public static final Creator<ScanSettings> CREATOR

Added in API level 21

Public Methods

public int describeContents ()

Added in API level 21

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

Returns
  • a bitmask indicating the set of special object types marshalled by the Parcelable.

public int getCallbackType ()

Added in API level 21

public long getReportDelayMillis ()

Added in API level 21

Returns report delay timestamp based on the device clock.

public int getScanMode ()

Added in API level 21

public int getScanResultType ()

Added in API level 21

public void writeToParcel (Parcel dest, int flags)

Added in API level 21

Flatten this object in to a Parcel.

Parameters
dest The Parcel in which the object should be written.
flags Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.