Hi, so this is my running app.
But distance and pace is not working, i tried everything but nothing helps. Can someone give me advice what to change? Thanks
Hi, so this is my running app.
But distance and pace is not working, i tried everything but nothing helps. Can someone give me advice what to change? Thanks
It’s pretty complicated to try and figure out all of those blocks. It would help if you posted the source of your equations and explained how you’re attempting to determine distance and pace.
So basically, in this setup, I’m using a timer to update the distance, pace, and route every 5 seconds. Then I check the user’s speed from the location data. If the speed is greater than zero, it means the user is moving, so the app calculates the distance, updates the total, draws the path, and saves the new location. If not, it skips those steps.
The problem is, I’m not sure how to use the map component’s polyline correctly. Right now, it’s not drawing the line. Also, the distance and pace aren’t updating, and they stay at zero even when I’m testing it and moving.
I’m calculating the distance with the Haversine formula, passing the initial latitude and longitude along with the current latitude and longitude. It should return the distance and then add it to the variable, but that’s not working. As for pace, I’m dividing the total minutes (I have this value in my stopwatch timer) by the total distance, but it’s not showing anything. I guess the problem is with the total distance variable, but I don’t know where it’s failing.