Scanning Options
ScanningOptions (ScanningOptions) controls IBluetoothScanner.StartScanningAsync(): permission behavior, advertisement filtering, scan mode/power trade-offs, and platform-specific parameters. See the type's generated page for the full property list — the source XML docs already include per-property platform-support notes.
Basic Usage
var options = new ScanningOptions
{
ServiceUuids = [myServiceUuid],
ScanMode = BluetoothScanMode.Balanced,
IgnoreDuplicateAdvertisements = true
};
await scanner.StartScanningAsync(options);
Filtering
Three filtering mechanisms compose together:
ServiceUuids— hardware-level filter (fastest, most battery-efficient; applied by the OS radio itself where supported)RssiThreshold— reject weak-signal advertisements before they reach your codeAdvertisementFilter— aFunc<IBluetoothAdvertisement, bool>predicate for anything hardware/RSSI filtering can't express
IgnoreDuplicateAdvertisements + CallbackType (BluetoothScanCallbackType) together decide whether you get one callback per device (discovery) or one per advertisement packet (RSSI/presence tracking).
Android-Specific Options
AndroidScanningOptions — MatchMode/ScanMatchNumber (API 23+), ReportDelay (batches results instead of delivering them immediately), Phy and Legacy (API 26+).
Best Practices
- Always specify
ServiceUuidswhen you know what you're looking for — scanning for everything costs battery and CPU for no benefit. - Match
ScanModeto the use case —LowLatencywhile a user is actively waiting on a device picker,LowPowerfor background monitoring (see Enumerations). - Enable duplicate filtering for pure discovery (
IgnoreDuplicateAdvertisements = true,CallbackType = FirstMatch); disable it when tracking RSSI/presence over time. - Set
ScanStartRetry = RetryOptions.Aggressivein production to absorb transient scan-start failures. - Use
AndroidScanningOptions.ReportDelayto batch results and reduce wakeups when you don't need immediate delivery. - Layer filters: hardware
ServiceUuidsfirst, thenRssiThreshold, thenAdvertisementFilterfor anything more complex.