Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workout time starts when GPS is started instead of when workout is started #1170

Open
samontab opened this issue Jan 8, 2024 · 3 comments
Open

Comments

@samontab
Copy link

samontab commented Jan 8, 2024

If you start the GPS but don't start the workout immediately afterwards, you will see that when you start running there is already some amount of time there. That's the time since the GPS started.

Ideally you would only start counting the workout time from the moment you press start, not when the GPS is started.

@roberi
Copy link
Contributor

roberi commented Jan 25, 2024

I have this issue as well. Once the GPS is first started and has has a signal, the problem occurs for me if I leave the app (ex. return to the home screen, start another app on top of RunnerUp, or turn of the phone screen). It is like the GPS then gets disconnected, but the notification still shows the "Ready to start running!" message and when returning to the app, it is still in the "start" state. When starting the workout it seems GPS needs to get connected again before the workout is started (but as @samontab says the time is since the GPS first was started).

EDIT: I have a Pixel 6 running Android 14.

@roberi
Copy link
Contributor

roberi commented Jul 18, 2024

I've looked into this a bit more. I am still not sure it is exactly the same issue as @samontab, but after clicking the "Start GPS" button, the app stops receiving location updates if it is no longer in the foreground. I found it is a behavior change starting with Android 8. The video below demonstrates this by logging the time difference since the last location update (should be about once every second).

For some devices, it seems it can take some time to start receiving location updates again. Perhaps when at a location with a poor GPS signal? If a user then clicks on the "Start" button before location updates are delivered again, this delay (between the last location when the app went to background and location updates starts again) gets added to the time (about 12 seconds in the video).

When testing on an emulator running Android 7 (the version before the behavior change), the app works as expected as location updates never stops. If the user clicks on the "Start" button after location updates are being delivered again, the app works as expected.

Possible fixes?

  • Use a foreground service to keep receiving location updates when not in the foreground.
  • Set state to "GPS searching" when not in the foreground.
  • Other?
test.mp4

@gerhardol
Copy link
Collaborator

When time is started a location point with the last known location is logged. The time is replaced with the current system time.
GPS and system may differ,there is an override to always use system time (that is now the default).
If there is no fix with the time override, I assume a foreground servive is preferred, so GPS is good when actually starting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants