I’m building an Uber like app and I’m trying to calculate the fare by saving LOCATION A and TIME A when the driver picks up the passenger.
Every 30 seconds I save LOCATION B and TIME B, now I use LOCATION A - B to get the distance and TIME A - B to get the second spent in the time.
I use these to calculate the final fare.
I calculate these every 30 seconds because the passenger might will end the ride at the pickup location (roundtrip) so I need an accurate distance of the actual travel distance.
The problem I’m having is that the calculation doesn’t run every 30 seconds, only if I turn on debug mode.
In debug slow mode everything looks fine but if I run It normally, nothing happens.
Attached a gif, on the top of the screen you can see the time and distance as only changes when debug mode is on.