2

Whenever I turn off the screen of my pixel 2 with Android 8.1, the scanner is turned off as it is already described here: BLE scan is not working when screen is off on Android 8.1.0

I tried specific scan filter attributes and also an empty scanfilter with no success, the scanner is disabled and wakes up after switching the screen on.

Logcat output (screen is turned off):

Cannot start the unfiltered scan in screen-off. This scan will be resumed later...

Any help would be greatly appreciated.

Community
  • 1
  • 1
Uf.Oe
  • 33
  • 4
  • What's your code? Apparently it thinks you perform an unfiltered scan. – Emil Jan 30 '18 at 16:10
  • Hi Emil, I simply add an empty scanFilter. `List filters = new ArrayList(); bluetoothLeScanner.startScan(filters, settings, ScanCallback);` Below Android 8.1 everything was working fine so far.. Have you got any idea? Actually if there is a an empty filter defined it should match any advertising packet, and still allow detections with the screen off on Android 8.1. – Uf.Oe Jan 30 '18 at 18:31
  • An empty list means no scan filters. You need to have at least one scan filter. Can't you provide a scan filter. I assume you are trying to scan a device that advertises a specific service? – Emil Jan 30 '18 at 20:22
  • Yes I try to scan for specific advertisements packets (ibeacon format). This was my first approach:`ScanFilter.Builder builder = new ScanFilter.Builder(); builder.setManufacturerData(0x004c, new byte[] {}); ScanFilter filter = builder.build();` but still I don't get any scan results when I switch off my display and following output still appears: Cannot start the unfiltered scan in screen-off. This scan will be resumed later... – Uf.Oe Jan 30 '18 at 21:20
  • I tested on Pixel 2 and I was able to reproduce this bug, but I was not on Pixel 2 XL running the same OS version. Maybe it is related to the device... – José Carlos Jul 05 '18 at 10:15

0 Answers0