Skip to content

Commit 77fdf74

Browse files
Ensure if offloaded filter is supported
1 parent 79491a6 commit 77fdf74

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

dfu/src/main/java/no/nordicsemi/android/dfu/internal/scanner/BootloaderScannerLollipop.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ public void run() {
8989
/*
9090
* Android 8.1 onwards, stops unfiltered BLE scanning on screen off. Therefore we must add a filter to
9191
* get scan results in case the device screen is turned off as this may affect users wanting scan/connect to the device in background.
92-
* See {@linktourl https://android.googlesource.com/platform/packages/apps/Bluetooth/+/319aeae6f4ebd13678b4f77375d1804978c4a1e1
92+
* See {@linktourl https://android.googlesource.com/platform/packages/apps/Bluetooth/+/319aeae6f4ebd13678b4f77375d1804978c4a1e1}
9393
*/
9494
final ScanSettings settings = new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY).build();
95-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
95+
if (adapter.isOffloadedFilteringSupported() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
9696
final List<ScanFilter> filters = new ArrayList<>();
9797
filters.add(new ScanFilter.Builder().setDeviceAddress(mDeviceAddress).build());
9898
filters.add(new ScanFilter.Builder().setDeviceAddress(mDeviceAddressIncremented).build());

0 commit comments

Comments
 (0)