Preventing App from Being Put to Sleep in Wear OS 4

521 views Asked by At

In Wear OS 4, a new feature was introduced to put apps into sleep mode while they run in the background. There's a list in Settings -> Battery -> Sleeping apps, with the apps that will be put to sleep and only occasionally run in the background.

My app is responsible for critical Bluetooth Low Energy (BLE) communication and runs in the background via a ForegroundService. Consequently, I need it to run constantly and not be put to sleep, which currently requires users to manually remove my app from the "Sleeping apps" list.

  1. Is there a way to programmatically ensure that my app is not placed into the sleeping apps list by default?
  2. Alternatively, can my app detect whether it is listed in the "Sleeping apps" so that I can notify users to remove it manually if necessary?

Any guidance or suggestions are highly appreciated. Thank you in advance!

1

There are 1 answers

0
Dan S On

its a behavior change, have opened the following bug in the issue tracker. Feel free to add more

https://issuetracker.google.com/issues/306580609

Bedtime, theater, DND and wet mode are all impacted by this. Work Manager jobs should still continue to run periodically but they dont.