Hello! I am a beginner coder working on an app that can hopefully help track shuttles within my school's campus. It basically streams the line (Line A or Line B), operating status (Active or Inactive), capacity (Full or Available), speed (km/h), heading (currently does not work) and location (coordinates) to an API WebSocket every 3 seconds. I was testing the app by driving around and I noticed that the location barely changes, so on the website that my friend made I seemed to teleport every 10-20 seconds. I was wondering if there is a way to fix this issue by streamlining my code or is it really just a problem caused by a weak signal/data. Any tips would be greatly appreciated not just by me but future users of the shuttle tracker! Attached are a few photos of my code. I know it's not the best, but it seems to work except the coordinates dont change as expected. Thank you! ![]()
How did you set DistanceInterval and TimeInterval? Sensors
Also it might make aense to set the Provider to gps and lock it for better signal; see a snippet here
Taifun
1 Like
In addition to the suggestions provided in Taifun's post
Things to consider:
- Speed calculation requires that there be at least 2 LocationChanged events must fire prior to providing a value.
- checking and or posting location etc. every 2 to 3 seconds may be impractical. The LS doen't get an updated satellite fix that rapidly.
- Factors like Accuracy of the satellite fix need to be considered. Perhaps you need to not use satellite fixes > than about 10 meters when you display locations.
- Your app does not have a StayAwake route or a Foreground or Background capability. When your reporting screen goes to sleep, it might go to sleep.
- Your Clock might be firing too frequently (3 seconds
)to capture all the data you are collecting. - Where are you getting the heading information from? Are you using an extension (the LocationSensor doesn't provide a heading but some extensions do.
- you might re-read Using the Location Sensor
Were you posting to a Map using Map component or just reading the latitude/longitude?
Apps like this usually require access to the app in order to be debugged
Here is a tutorial (made a long time ago that works) that shows a way to post a bus (shuttle) location How to broadcast a GPS location and share the information on a map with others in real time..CloudDB Perhaps there are some ideas you can use?
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

