jithware / brethap

https://jithware.github.io/brethap
GNU General Public License v3.0
47 stars 10 forks source link

[Bug]: Timing is wrong when display is off #100

Closed joemaro closed 1 year ago

joemaro commented 1 year ago

For me it's essential that i can turn off the display during a session, but then brethap will not time the steps correctly. I've measured several cycles and the timing was correct about half the time and too late the other half ... The most off i've seen was 8 seconds late. It makes no difference whether my device (Xiaomi Poco m4 pro) is in energy saving mode or not.

To Reproduce Steps to reproduce the behavior:

  1. Start a session
  2. Turn off the display
  3. measure whether the sounds or the vibration is on time

Expected behavior well, i'd like it to be on time :)

Smartphone (please complete the following information):

PS: Apart from that, i love the app and want to thank you for making it!!! <3

joemaro commented 1 year ago

Added the info that I installed this from F-Droid, but the edit doesn't seem to happen ...

jithware commented 1 year ago

This behavior is because Brethap does not have permission to run in the background. I would prefer not to implement background capabilities as it would require additional permissions and a background service. Currently brethap only requires two permissions - vibrate (for vibration) and network access (for opening help/report from the about menu). I'd like to keep permissions to a minimum to ease users concerns about privacy.

When running, brethap automatically keeps the display on until the session ends (unless of course you manually turn off the display). This is so it can continue to run in the foreground. If you have to have the display off, as a workaround you should be able to set the inhale/exhale audio to a tone and brethap will continue to run as long as an audio is played every few seconds or less. Not ideal but this works for the default preset (4 seconds inhale + tone 1 --> 4 seconds exhale + tone 3), from my testing anyway. I could add a 'silent' tone for the max breath length and in theory this could work for longer cycles.

jithware commented 1 year ago

Added additional silence to audio files that should allow for the cycle to continue when the display is off. If no sound is desired, set the audio to "Silence" for inhale and/or exhale audio when shutting off the display or to "None" when running normally.

In release >= 1.7.17+110