Android Question GPS: location is not changing if speed is zero

Shay

Well-Known Member
Licensed User
Longtime User
Hi

I have very strange issue with the GPS
I am using GPS.start (0,0)
while location.speed = 0 (b.t.w how can it get speed from SAT?)
the location.latitude and location.longtitude are the same from previous reading
if speed is above 0, then it is ok

the problem is, if I set my location, now my distance for my location is 0
then I am starting to move very slowley away from my location
I can be 50 meter far from my location and still it will show that my distance to my location is zero

???!!
 

Shay

Well-Known Member
Licensed User
Longtime User
Thanks, but I don't think this is the case
I think this is some kind of bug in the library
can some expert check it? it is very easy to replicate
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
I am using standard code from GPS library example
I added logs and saw that is location1.speed is zero, the location.lon/lat are not changing with the below function

GPS_LocationChanged (Location1 As Location)
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
I am using standard code from GPS library example
I added logs and saw that is location1.speed is zero, the location.lon/lat are not changing with the below function

GPS_LocationChanged (Location1 As Location)

Ok, what hardware are you using? I bought a cheap Chinese tablet 3 years back and the GPS speed would not kick in until I was above 14 kmh. It was very frustrating since it was my only device. My new devices work properly with GPS- including the Location_changed event.
 
Upvote 0

rbsoft

Active Member
Licensed User
Longtime User
What parameters did you use to start Gps?

Quote from Gps Help:
Start (MinimumTime AsLong, MinimumDistance AsFloat)
Starts listening for events.
MinimumTime - The shortest period (measured in milliseconds) between events. Pass 0 for highest frequency.
MinimumDistance - The shortest change in distance (measured in meters) for which to raise events. Pass 0 for highest frequency.

Rolf
 
Upvote 0

tchart

Well-Known Member
Licensed User
Longtime User
Thanks, but I don't think this is the case
I think this is some kind of bug in the library
can some expert check it? it is very easy to replicate

Are you sure? Can you test on another device? Ive not had any problems with the library?
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
I will post the code, I have to clean it
it is easy to replicate, you set some location and get the distance to it
then you walk very slowly away from it, and see that distance is not changing

for a workaround (it is working better but still has issue) I changed the distance from int to float
so even my ditance is 0.something it will take reading
(maybe this was the problem)
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
Speed is not actually zero (see first post) but issue was using integer and not float
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I'm afraid we are turning in circle.
What exactly do you display ?
What exactly do you get when you move ?
Do the lat / lng coordinates change when you move ?

Without knowing what exactly you have done and how impossible to give you a concrete help.
Again, post your code.
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
thanks, but this issue is closed for the past 7 months, I don't know why Beja brought it back to the table
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
As I wrote the issue was that I used my "speed" var as integer, and it need to be float
 
Upvote 0

adrianstanescu85

Active Member
Licensed User
Longtime User
I use the GPS location in my application with the same settings, I stand still and the results get updated every second or so. The speed is never an absolute 0, I guess the GPS actually has to get a location first and calculate the speed after that so that it has a reference point first (the previous reading). If we'd convert the speed to cm/h instead of km/h it would never be 0 and that's obvious, it even implies a new reading on each speed prompt.

I've been using the standard GPS library that came with each version of B4A up to the latest one, and in my application I'm listing the current GPS coordinates at all times, most of which imply the user standing still and not travelling. It works great and it did so from the very start. I used the application on a Samsung Galaxy Note 3, a Samsung Galaxy Tab 8.4", a Motorola ET1, a Motorola TC55 and a few other devices, all working just as they should.

I'd suggest looking into the placement of code inside the Pause, Resume activities to make sure everything is in the right place.
 
Last edited:
Upvote 0

Beja

Expert
Licensed User
Longtime User
the problem is, if I set my location, now my distance for my location is 0
then I am starting to move very slowley away from my location
I can be 50 meter far from my location and still it will show that my distance to my location is zero
So you are setting the location not acquiring it from satellites?
Another question, did you make a any typo in the name of the label or edittext referenced in the code?
As Klaus suggested, it would be helpful if you posted the part of the code that doing this function, otherwise
it is impossible to imagine what is in there.
 
Upvote 0
Top