BLE scan stops on Samsung devices when screen is locked

3

I'm implementing a Bluetooth low energy scanning app. I setup an empty scan filter to avoid the 8.1+ restrictions of scanning while screen is locked.

ScanFilter filter = new ScanFilter.Builder().build();
        ScanSettings.Builder builder = new ScanSettings.Builder();
        //CONSTANT FOR LOW BATTERY MODE
        builder.setScanMode(0x00000000);
        final ScanSettings ss = builder.build();
        final List<ScanFilter> filters = new ArrayList<>();
        filters.add(filter);


        AsyncTask.execute(() -> {
            if (btScanner != null && btAdapter != null && btAdapter.isEnabled()) {
                System.out.println("STARTED SCANNING");
                btScanner.startScan(filters, ss, leScanCallback);
                scanning = true;
            }
        });

This method works when scanning on devices other than Samsung ones. Has anyone been able to scan for BLE devices while the screen is locked on Samsung devices? I have also tried MAC address filtering, but that doesn't seem to work either.

java
android
bluetooth
bluetooth-lowenergy
android-bluetooth
asked on Stack Overflow May 2, 2019 by Miguel Freitas • edited Oct 30, 2020 by Hari Shankar S

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0