AndroidOptions class

Scan models Android options to scan devices requestLocationPermission is used to request location permission on Android 12+ (API 31+). scanMode is used to set the scan mode for Bluetooth LE scan. Set reportDelayMillis timestamp for Bluetooth LE scan. If set to 0, you will be notified of scan results immediately. If > 0, scan results are queued up and delivered after the requested delay or 5000 milliseconds (whichever is higher). Note scan results may be delivered sooner if the internal buffers fill up. callbackType, matchMode, and numOfMatches map directly to the equivalent android.bluetooth.le.ScanSettings setters. When null, the plugin leaves them at the platform default — set them only if you need to override platform-side advert de-duplication (e.g. on Pixel hardware where the default settings throttle advertisements compared with nRF Connect).

callbackType is a list because Android's setCallbackType accepts any bitwise combination of AndroidScanCallbackType values (for example [firstMatch, matchLost] to be notified once on entry and again on exit). The plugin OR-folds the list before calling the native API. Values that require a newer API than the device supports are silently dropped (and logged); see the AndroidScanCallbackType doc for per-value API levels.

legacy controls whether only legacy advertisements (BLE 4.2 and below) are returned (API 26+). When null or false, the plugin scans for BLE 5 extended advertisements only (the library default, unchanged from prior releases). Set to true for legacy BLE 4.x advertisements (e.g. ESP32); on API 26+ the plugin sets setLegacy(true) and does not set PHY.

See https://developer.android.com/reference/android/bluetooth/le/ScanSettings

Constructors

AndroidOptions({bool? requestLocationPermission, AndroidScanMode? scanMode, int? reportDelayMillis, List<AndroidScanCallbackType>? callbackType, AndroidScanMatchMode? matchMode, AndroidScanNumOfMatches? numOfMatches, bool? legacy})

Properties

callbackType ↔ List<AndroidScanCallbackType>?
getter/setter pair
hashCode → int
The hash code for this object.
no setteroverride
legacy ↔ bool?
getter/setter pair
matchMode ↔ AndroidScanMatchMode?
getter/setter pair
numOfMatches ↔ AndroidScanNumOfMatches?
getter/setter pair
reportDelayMillis ↔ int?
getter/setter pair
requestLocationPermission ↔ bool?
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scanMode ↔ AndroidScanMode?
getter/setter pair

Methods

encode() → Object
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override

Static Methods

decode(Object result) → AndroidOptions