6

It's working well on most Android devices. Other device's screen gets locked after 1 minutes BLE device gets disconnected,if device without charger.

Thanks for any suggestions!

user4680074
  • 71
  • 1
  • 3

2 Answers2

0

this might come from the Keep Wi-Fi on during sleep option (which might affect all radios) - as it seems this only exists in 8.0 but not in 8.1 (at least on the Pixel 2 XL, according to this article).

enter image description here

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
0

You might be having this problem because your app is not properly configured to handle Doze mode.

While there do not seem to be any restrictions on using BLE itself, doze mode might be messing with the control mechanism for your bluetooth connection (ex: a background service).

To see if this is the issue, you can whitelist your app manually via Settings > Battery > Battery Optimization and disabling optimization for your app.

Furthermore, as of Android 8.0, there are restrictions on background services when your app is not in the foreground. So, you may need to create a foreground service to handle the connection.

BLuFeNiX
  • 2,496
  • 2
  • 20
  • 40
  • it's not working. I've tried add app to white list via settings and programmaticaly. Service is foreground too – Kurrrrwa Oct 29 '18 at 20:25
  • @Kurrrrwa are there any error logs? Are you 100% sure that you aren't swallowing any exceptions? – BLuFeNiX Oct 29 '18 at 22:23
  • havn't any error. log is clear. device disconnected only when phone is not charging. Service stay alive – Kurrrrwa Oct 31 '18 at 13:27