Kris Thanks for the detailed steps and structured explanation of what your observations!
When controlling the timer using the menu bar (or the dock icon context menu), a sync isn't performed immediately, but every 5 minutes. So even if you don't close the app on your Mac, it might take up to 5 minutes until the database is uploaded. That doesn't mean this information is on your Android phone then - the data is just on your Google Drive. Then it can take another 15 minutes (or longer, depending on when the Android system calls the app's background task) until this data is downloaded from Google Drive to your Android phone and the timer status is changed accordingly.
That said, the problem is likely that you put your laptop to sleep before any sync-upload on your Mac can happen (as you say just a few seconds after you click the stop button). I see that this can be a common use-case when stopping work at the end of the day.
I am not sure what you are referring to with ActiveWindowListener
and BackgroundSyncListener
- at this time, WorkingHours doesn't register any services that can run if the app itself is not running.
I can make the following change with the next update: When the user starts/stops/pauses the timer using either the menu bar item or the dock item context menu and the app's window is not visible (it's either minimized or closed), the app performs a sync immediately after that. Do you think this would help or do you think the app also needs to perform immediate syncs in other situations or even when the app's window is visible?