Scans with screen turned off on Android 8.1 and above fail

  • @ryanbis I was able to test on the Moto x4 that was displaying the connection problem and it is working well with the new library. I haven't been able to reach our customer with the Samsung Note 9 yet so I'm not sure of performance on that platform at this time. Hopefully I hear from him this week.

  • @ryanbis Just got a message from our customer with the Note 9. He says that he is still experiencing the issue with the snapshot library where there is no communication when the phone is locked. Are there other Android settings that might be causing this issue? I'm not as familiar with Android's settings as I am with iOS so maybe there is something I am not aware of that may be contributing to this issue. The snapshot library did appear to correct the issue on the Pixel and Moto X4 phones so this Samsung is a mystery. Is there other information I can gather for you that might help? Do you guys have a Note 9 to test with?

  • @ryanbis I have a Samsung Galaxy S10 running Android 9. When I turn the screen off, I get this message in LogCat:

    2019-03-26 15:30:25.909 13902-13902/? W/BleService: State changed: StateEvent
    entered = [SCANNING]
    exited = [STARTING_SCAN]
    current = [ON, SCANNING, BLE_SCAN_READY]
    2019-03-26 15:30:25.910 7233-7314/? W/BtGatt.ScanManager: Cannot start unfiltered scan in screen-off. This scan will be resumed later: 7

    Is there a new API that I need to call to force the filtered scan? The snapshot build seemed to correct the issue on the Moto and Pixel, but doesn't on the Samsung and I just noticed this error. Perhaps there is still something missing? I don't know where the change is in the snapshot build, but I do see a getFilterList() call in the L_Util class that appears to return the empty ScanFilter list. Does this empty item get populated further up the call tree or should there be something else happening in the getFilterList() method when running on Oreo 8.1 or Pie 9.0?

  • Did you set the BleManagerConfig.defaultNativeScanFilterList option? If not, then it will not work. It's a List of the android ScanFilter object class.

  • @ryanbis The snapshot library doesn't have a defaultNativeScanFilterList option. It only has a defaultScanFilter setting.

  • Ok if it doesnt have that option, it doesn't have any fix in it. Sorry about that, something must have gotten screwy in the build. 0_1553796909134_sweetblue- This aar definitely has that option. That needs to be set in order for you to receive results in your scan when the screen is off.

  • @ryanbis Thanks for the quick response! This library is working well. Should I do a version check and set the defaultNativeScanFilterList only when the O/S is 8.1 or higher or can I always set it and SweetBlue will determine when to use it?

  • Just set it. They will always be used (with the post lollipop API).

  • @ryanbis heard back from our customer with the Note 9. He said things worked perfectly with the new library. So, when can we get a production release? 🙂 Thanks for all of the help on this one.

  • We're looking at around 2 weeks or so before we put out the official release.