Hello, I’m trying to build a simple GPS tracker. I would like to have a simple app with a map that opens to the current location and has a couple of buttons. One button would start recording locations as I move (riding in a UTV), and record GPS Longitude and Latitude to a Google Doc Sheet. Another button would stop the recording.
I have the Map component in the UI. I also have a block with a location sensor that also can get my current location. For the Map event “OnUserLocationChange” I was seeing a bunch of odd behavior. After a lot of debugging with setting Waits and Updating Label text, I discovered this event fires when I’m sitting absolutely still and once it fires, it speeds up faster and faster. The rest of the steps I had programmed in the event logic would rarely complete (updating the spreadsheet), but new events continue to fire to the point when my phone will begin heating up and eventually will lock up the phone.
Those blocks should create 25 seconds of delay after the location changes. But keep in mind that every change to the location is going to trigger the whole series of blocks to fire again. So it could theoretically trigger every few milliseconds.
I don’t have a lot of experience with the location sensor but my guess is that you’ll need to either use only a loop with GetCurrentLocation (and not the onUserLocationChange block) or have a conditional statement (if/else) that checks to see if the changed location is a certain distance from the last location – or if it’s been a certain amount of time since the last detected change.
My phone was still and yet the counter I set up starts off slow (1 update after a few seconds), but then quickly gets into a tight loop. I suspect a bug in the location change Event logic of Thunkable. I’ll have to see if I can work around it. Thanks again!
If you want to share the project link, I can test it on my phone and see if I can figure out why it’s doing that (it’s possible it’s a bug, as you mentioned).