Cannot start workout #194

Closed
opened 1 year ago by jannis · 12 comments
jannis commented 1 year ago
Owner

A bug reported by many users. Still not sure why and cannot reproduce. Additional information appreciated.

What seems to happen from user perspective:

  • FitoTrack displays "Cannot Start" on the start button -> user cannot start workout
  • happens on some devices every time / not on other devices
  • GPS is okay (tested with other apps)

What seems to happen from code perspective:

Two possibilities:

  1. It seems like the WorkoutRecorder class isn't notified about location changes whereas the Activity is (RecordWorkoutActivity).
  2. The WatchDogRunner isn't running and cannot check whether the recorder got location updates. BUT: On screenshots sent by users, the notification is visible so the watchdog must have been started at least at some point.
A bug reported by many users. Still not sure why and cannot reproduce. Additional information appreciated. **What seems to happen from user perspective:** - FitoTrack displays "Cannot Start" on the start button -> user cannot start workout - happens on some devices every time / not on other devices - GPS is okay (tested with other apps) **What seems to happen from code perspective:** Two possibilities: 1. It seems like the `WorkoutRecorder` class isn't notified about location changes whereas the Activity is (`RecordWorkoutActivity`). 2. The `WatchDogRunner` isn't running and cannot check whether the recorder got location updates. BUT: On screenshots sent by users, the notification is visible so the watchdog must have been started at least at some point.
jannis added the
bug
label 1 year ago

I can reproduce here on Android 6 and 9.
Is there any log file I can send you or is there a debugging version?
I can use adb if needed.
logcat doesn't seem to show anything useful.

I can reproduce here on Android 6 and 9. Is there any log file I can send you or is there a debugging version? I can use adb if needed. logcat doesn't seem to show anything useful.

After more testing, it seems to be caused by a weak GPS fix. So the message should be changed, and the quality of the fix could be shown, like RunKeeper does:

After more testing, it seems to be caused by a weak GPS fix. So the message should be changed, and the quality of the fix could be shown, like RunKeeper does:

I am seeing this issue as well. Starting the app well before the workout will at some point get a fix on the GPS and I can start. Weirdly the GPS in maps works without issue at the same time.

I am seeing this issue as well. Starting the app well before the workout will at some point get a fix on the GPS and I can start. Weirdly the GPS in maps works without issue at the same time.

Yeah it is also caused on my phone (OnePlusTwo) because of a weak GPS signal. I use the app "GPSTest" (fDroid), only if there is my position (lat,long) shown, FitoTrack is able to start the workout.

Mabye it could be written that the GPS is low ("Waiting for better GPS..."), but it makes sense not to start the run anyway because the accuracy probably won't be that good?

@jannis: What do you mean with "GPS is okay (tested with other apps)", is it a fully strong GPS signal, so that you lat/long is displayed (e.g. by GPSTest)?

Yeah it is also caused on my phone (OnePlusTwo) because of a weak GPS signal. I use the app "GPSTest" (fDroid), only if there is my position (lat,long) shown, FitoTrack is able to start the workout. Mabye it could be written that the GPS is low ("Waiting for better GPS..."), but it makes sense not to start the run anyway because the accuracy probably won't be that good? @jannis: What do you mean with "GPS is okay (tested with other apps)", is it a fully strong GPS signal, so that you lat/long is displayed (e.g. by GPSTest)?
Poster
Owner

@jannis: What do you mean with "GPS is okay (tested with other apps)", is it a fully strong GPS signal, so that you lat/long is displayed (e.g. by GPSTest)?

On some devices the GPS signal is fine but FitoTrack still displays "Cannot Start" for some reason... Couldn't reproduce this though

Mabye it could be written that the GPS is low ("Waiting for better GPS..."), but it makes sense not to start the run anyway because the accuracy probably won't be that good?

The "Cannot start" text is really not great. Yes, it probably should be more precise and maybe display stats like number of found satellites.

> @jannis: What do you mean with "GPS is okay (tested with other apps)", is it a fully strong GPS signal, so that you lat/long is displayed (e.g. by GPSTest)? On some devices the GPS signal is fine but FitoTrack still displays "Cannot Start" for some reason... Couldn't reproduce this though > Mabye it could be written that the GPS is low ("Waiting for better GPS..."), but it makes sense not to start the run anyway because the accuracy probably won't be that good? The "Cannot start" text is really not great. Yes, it probably should be more precise and maybe display stats like number of found satellites.
Poster
Owner

I've gone through the code another time and noticed this line:

System.currentTimeMillis() - lastFix.getTime() > SIGNAL_LOST_THRESHOLD

If this expression is true, the last fix is considered as too old and not valid. What if the system time differs from the real time for more than SIGNAL_LOST_THRESHOLD? All fixes will be considered as too old even if they're not.

The documentation of Location.getTime():

Return the UTC time of this fix, in milliseconds since January 1, 1970.

Note that the UTC time on a device is not monotonic: it
can jump forwards or backwards unpredictably. So always use
{@link #getElapsedRealtimeNanos} when calculating time deltas.

So this could actually be the problem causing the bug. I really hope it is xD

(See 5aedf30bb2 for potential fix)

I've gone through the code another time and noticed this line: `System.currentTimeMillis() - lastFix.getTime() > SIGNAL_LOST_THRESHOLD` If this expression is true, the last fix is considered as too old and not valid. What if the system time differs from the real time for more than SIGNAL_LOST_THRESHOLD? All fixes will be considered as too old even if they're not. The documentation of `Location.getTime()`: > Return the UTC time of this fix, in milliseconds since January 1, 1970. > > Note that the UTC time on a device is not monotonic: it > can jump forwards or backwards unpredictably. So always use > {@link #getElapsedRealtimeNanos} when calculating time deltas. So this could actually be the problem causing the bug. I really hope it is xD *(See 5aedf30bb2 for potential fix)*
Poster
Owner

I can confirm that this is our bug. I did the following:

  • set system time to 10 minutes in the future
  • FitoTrack was showing a moving map but "Cannot start" still shows up -> I could reproduce this for the first time 🥳
  • set system time back to "network time"
  • FitoTrack is back to normal

I can also confirm the fix. After updating to the new commit it works even with future system time. Finally this was fixed!

I can confirm that this is our bug. I did the following: - set system time to 10 minutes in the future - FitoTrack was showing a moving map but "Cannot start" still shows up -> I could reproduce this for the first time 🥳 - set system time back to "network time" - FitoTrack is back to normal I can also confirm the fix. After updating to the new commit it works even with future system time. Finally this was fixed!

Hi, I fixed the problem on Android 10 as well.

Background: Some days ago I deactivated a function within my mobil in a way that the time and date is not checked by the network anymore but is only set fix once manually. (I did it because there was a slide delay on by mobil displaying the correct time on the display which was anoying. The clock needed some seconds to get the correct time.) Since then I realized the problem described above by others: Cannot start the workout despite the mobil receives a GPS signal.

Re-activating the function that the time is checked by the network, I can again start workouts without problems.

As a consequence I believe the app requests the workout starting time and/or date only from a network and not by the mobil itself. Or the app requests this parameter by a specific network format only and the android format is not accepted/known (that's why the workout cannot start).
Maybe it is a good idea for the next patch/release version to enhance the code by test the use case I described above to check if the app is also running not getting time/date by check against the network.

Hope I could help somehow.
By the way - I'm proud of all the people who continuely developing/testing this great app !! :)
BR

Hi, I fixed the problem on Android 10 as well. Background: Some days ago I deactivated a function within my mobil in a way that the time and date is not checked by the network anymore but is only set fix once manually. (I did it because there was a slide delay on by mobil displaying the correct time on the display which was anoying. The clock needed some seconds to get the correct time.) Since then I realized the problem described above by others: Cannot start the workout despite the mobil receives a GPS signal. Re-activating the function that the time is checked by the network, I can again start workouts without problems. As a consequence I believe the app requests the workout starting time and/or date only from a network and not by the mobil itself. Or the app requests this parameter by a specific network format only and the android format is not accepted/known (that's why the workout cannot start). Maybe it is a good idea for the next patch/release version to enhance the code by test the use case I described above to check if the app is also running not getting time/date by check against the network. Hope I could help somehow. By the way - I'm proud of all the people who continuely developing/testing this great app !! :) BR
Poster
Owner

Yeah, it should be fixed in version 10.2 but Google Play rejected the update bc of the background location permission. Google Support doesn't reply :/

Yeah, it should be fixed in version 10.2 but Google Play rejected the update bc of the background location permission. Google Support doesn't reply :/

Would it be possible to add the apk to the release?

Would it be possible to add the apk to the [release](https://codeberg.org/jannis/FitoTrack/releases)?
Poster
Owner

Would it be possible to add the apk to the release?

good idea actually 👍, done :)

> Would it be possible to add the apk to the [release](https://codeberg.org/jannis/FitoTrack/releases)? good idea actually 👍, done :)
jannis referenced this issue from a commit 10 months ago
Poster
Owner

I think this can be considered as closed now :)

I think this can be considered as closed now :)
jannis closed this issue 10 months ago
Sign in to join this conversation.
No Milestone
No Assignees
5 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.