iOS Question Gps is not very accurate

Mike1970

Well-Known Member
Licensed User
Longtime User
Hi, I’m using the library iLocation, with the various PlisExtra from Erel’s tutorial about background tracking.
The problem is that it isn’t very accurate.

There is something like “Fine location/Coarse Location” of b4a?
Or a parameter to set it to be more precise ?

Thanks !
 

JohnC

Expert
Licensed User
Longtime User
When the GPS service is running, it will constantly "capture" location data in a loop. The longer it is doing "captures", the more accurate the captures generally get because the GPS receiver starts to hear for more and more satellites to get a better fix (the more satellites the better)

There are two properties of Erel's "location" object:

Location.AccuracyValid = True - means that the Location.Accuracy property value is working properly.
Location.Accuracy property reports how accurate the latest capture was (in meters).

So, have your code wait until the AccuracyValid is true, then have it wait until the Accuracy is the precision you need (like 10 meters).

But keep in mind, there are MANY factors that may not allow the accuracy to get down to 10 meters no matter how long you wait.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
aside from government regulations limiting gps accuracy to no less than 10 meters
(in the case of the U.S.), you don't cause gps to be "more" or "less" accurate.
the degree of accuracy is determined by whether or not you are using gps to
locate your position.

a gps device does what it does, which is to poll gps satellites for their positions.
when it has found enough satellites to compute its own position, it reports that
position back to you. you can determine how often you would like that position
updated. once it has a postion, it doesn't deliberately give you a less accurate
one. if it can't compute a position (due to lack of visible satellites), it doesn't
make one up. using a gps in a new location for the first time may take several
minutes to find a position. once found, it makes note of the satellites it used.
if you go to some other part of the world, it has to search for new satellites
once it realizes it can't find the ones it knew about. but this has nothing to do
with accuracy.

if you choose to locate your position by not using gps, you achieve so-called
coarse accuracy. both apple and android use wifi and cellular towers for this.
if you ask for "fine" accuracy, it means the app is to use gps, in addition.
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
When the GPS service is running, it will constantly "capture" location data in a loop. The longer it is doing "captures", the more accurate the captures generally get because the GPS receiver starts to hear for more and more satellites to get a better fix (the more satellites the better)

There are two properties of Erel's "location" object:

Location.AccuracyValid = True - means that the Location.Accuracy property value is working properly.
Location.Accuracy property reports how accurate the latest capture was (in meters).

So, have your code wait until the AccuracyValid is true, then have it wait until the Accuracy is the precision you need (like 10 meters).

But keep in mind, there are MANY factors that may not allow the accuracy to get down to 10 meters no matter how long you wait.
really?? I look for that many times, I didn't saw.. I check immediately

OHHHH ok i understand! I was looking for that settings in the LocManager properties because I thought was something related to it, now I understood that I have to work with the LOCATION object given by the LocationChanged event!
Thanks!

Something like that right?

B4X:
Sub LocationManager_LocationChanged(Location1 As Location)
    If Location1.Accuracy <= METERS Then
        'do things'
    End If
End Sub
 
Last edited:
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
aside from government regulations limiting gps accuracy to no less than 10 meters
(in the case of the U.S.), you don't cause gps to be "more" or "less" accurate.
the degree of accuracy is determined by whether or not you are using gps to
locate your position.

a gps device does what it does, which is to poll gps satellites for their positions.
when it has found enough satellites to compute its own position, it reports that
position back to you. you can determine how often you would like that position
updated. once it has a postion, it doesn't deliberately give you a less accurate
one. if it can't compute a position (due to lack of visible satellites), it doesn't
make one up. using a gps in a new location for the first time may take several
minutes to find a position. once found, it makes note of the satellites it used.
if you go to some other part of the world, it has to search for new satellites
once it realizes it can't find the ones it knew about. but this has nothing to do
with accuracy.

if you choose to locate your position by not using gps, you achieve so-called
coarse accuracy. both apple and android use wifi and cellular towers for this.
if you ask for "fine" accuracy, it means the app is to use gps, in addition.

I don't need so much precision, but at the moment it fail of about 200/300 meters..
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Something like that right?

More like this:
B4X:
Sub LocationManager_LocationChanged(Location1 As Location)
    If Location1.AccuracyValid = True then
        If Location1.Accuracy <= METERS Then
           'do things'
        End If
     End if
End Sub
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
More like this:
B4X:
Sub LocationManager_LocationChanged(Location1 As Location)
    If Location1.AccuracyValid = True then
        If Location1.Accuracy <= METERS Then
           'do things'
        End If
     End if
End Sub

I don’t have the method “AccuracyValid”
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
It's a Boolean "property" and should be right under Location1.Accuracy:

B4A-2020-02-06 15_12_46.png
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Oh, my bad - I am using the Android Lib - so the iOS lib might not have that property.
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
Is the accuracy better when the app is in the foreground?
I hadn't a way to measure the accuracy until yesterday.. so at the moment (because I didn't well test it yet) I can't answer this question.
At the moment I could reach even about 5m of accuracy (when in foreground). I didn't test it in background
 
Upvote 0
Top