GPS Speedometer Troubles

Ive been attempting to incorporate a speedometer into my APP.
currently, I cant seem to get it to read anything - probably something simple that im not understanding.
I have tried it outside in a moving vehicle - ruling out metal roof building and what not.
pictures below of my code:

(I was converting to MPH and keeping the value appearing in a 000 config. so 10mph would register as 010 MPH on screen. all that aside, I completely bypassed that in the code to rule it out as the issue)


Does this work for you A Basic LocationSensor Speedometer

You might try setting your TImeInterval to 20000 to 30000 ms using Blocks in the Screen1.Initialize event handler.

Also check your 001 substitution algorithm using DoIt confirm it actually works. Alternatively, temporarily do not use the algorithm; just post 'raw' speed and see if your speedometer works then.

in the function posted above I actually have the 000 blocks bypassed where im pulling speed variable directly.
granted, im marrying that with a KPH string, so perhaps thats the issue?
also - im unsure of what you are referring to when you say "Dolt"

is there a reason id change the time interval in blocks vs just changing it in the setup?

also, forgot to mention - when the app opens, it pops a notification requesting to use position info. I do confirm that and have followed that up to verify in phone settings that location permission is on for the app.

Because you can not use the recommended values using the Designer :cry: '


Normal response.:slight_smile:

DoIt** Live Development, Testing and Debugging

What happens when you try the example?

with just the raw speed being called to display on screen - on one occasion I saw a value. a single value.
the rest of the time it just sits and says 0. even while driving. even while driving for awhile.

im working on getting to the root of this issue as we speak - its my only hickup on whats actually a pretty large app - hopefully one of us will track down the solution here lol

Are you using an Android 12 or 13? That happens when I run the app in my Android 12. When I run it on my Android 8.1 speed works fine. :slight_smile:

I suspect the changes Google made in 12.13 broke the App Inventor LocationSensor1.LocationChanged event for speed. :cry: speed never reports anything other than 0 on 12/13 however lat and lon and accuracy report correctly.

this works - so now its a matter of what backend thing my own app is interfering with.
I modified this to pull speed and display it also - even at a 100ms interval, all runs clean.
yes, i am using a new android, but again the below app works.
LocationSensorTest (1).aia (16.4 KB)

what version of Android are you using please?

update for 12 that was released 11/11/22

narrowed it down to either:
A. I called the intervals and enable in the screen initialization blocks - where i hadnt before.
B. I moved the write to textbox function outside of the local variable "initialize in" function.
C. set variables to distance delta 0, time delta 100ms.
realistically none of that should have mattered - but now it works. backend thing? idk.

long story long, it now works in my main app - updates every 100ms without too much lag.

for anyone reading this - probably was using the round function incorrectly in my picture above, although that had been bypassed in my testing as noted above. switched round to declare decimal math function and set it to 0.