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.
User contributions licensed under CC BY-SA 3.0