Android Question GPS question : altitude data

Status
Not open for further replies.

DOM85

Active Member
Licensed User
Hello,
Vhen i try to obtain the altitude data, i obtain values strongly differents between many smartphones with exactely the same app..
I know that this information is not accurate, but the differences between the smartphones in the same time is stable and very important (+5 times).

For example, on one i obtain 12, while on the 3 others i obtain 66.
I don't understand.
Thank you for any help.

My code is like this :

B4X:
Sub Process_Globals
    Dim GPS1 As GPS  ' GPS Library Ver 1.20
End Sub

Sub Globals
    Dim Altitude As Float
End Sub

Sub Activity_Create(FirstTime As Boolean)
    GPS1.Initialize("GPS")
    GPS1.Start(0, 0)
End Sub

Sub GPS_LocationChanged(Location1 As Location)
    Altitude = Location1.Altitude
 

klaus

Expert
Licensed User
You should consider the NMEA results and use Altitude above sea level.

I use this code in my GPSExample project to overcome the problem:
B4X:
Sub GPS1_NMEA (TimeStamp As Long, Sentence As String)
    If Sentence.SubString2(0, 6) = "$GPGGA" Then
        Dim vals() As String
        vals = Regex.Split(",", Sentence)
        If IsNumber(vals(9)) Then
            GPSAltitudeSeaLevel = vals(9)
        End If
    End If
End Sub
Sub GPS1_NMEA is a GPS event.
 

DOM85

Active Member
Licensed User
You should consider the NMEA results and use Altitude above sea level.

I use this code in my GPSExample project to overcome the problem:
B4X:
Sub GPS1_NMEA (TimeStamp As Long, Sentence As String)
    If Sentence.SubString2(0, 6) = "$GPGGA" Then
        Dim vals() As String
        vals = Regex.Split(",", Sentence)
        If IsNumber(vals(9)) Then
            GPSAltitudeSeaLevel = vals(9)
        End If
    End If
End Sub
Sub GPS1_NMEA is a GPS event.
I tried your example.
Now the first smartphone (gaving 12 in the past) give always 0 -but i am not at sea level).
And the 3 others smartphone seem to give a realist alitutde !
 

DOM85

Active Member
Licensed User
Note that there is a new GPS library available.
Maybe it does make a difference
https://www.b4x.com/android/forum/threads/gnss-library-an-updated-gps-library.109110/
I tried GSS library.
Same result : The first smartphone gives a realist altitude, and the 3 others give an altitude between 3 to 5 times upper.

However :
======
From Playstore i loaded an app named "GPS STATUS".
And it gives a realist altitude on all the 4 smartphone without difference!

So, is there any particularity to know in B4A ?
 

DOM85

Active Member
Licensed User
Probably related to the geoid vs. the ellipsoid heights: https://stackoverflow.com/questions...e-incorrect-due-to-not-including-geoid-height

The GPS library passes the altitude exactly as it receives it from the OS.
I understand, GPS Library do not decodes the "GGA" NMEA sentence containing the altitude.
However, the Playstore app "GPS STATUS" works without problem and gives similar altitude values on all my smartphones with only 5m difference between them..

In the same time and place, GPS Library gives 12m on a smartphone, and near 70m on the 3 others, even after waiting a long time to obtain a max number of satellites. This difference is stable.

I tried to catch all the NMEA sentences thru GPS Library, and to decode it. But with no hope result.
The "GGA" sentence is received by my app with no data inside like this "$GPGGA,,,,,,,,,".

The problem seems to reside between OS and B4A.
 

DOM85

Active Member
Licensed User
Not at all. The GPS library doesn't do anything with the altitude except of passing it to your program.
The GPS library also doesn't do anything with the NMEA string except of passing it to your program.
Ok. Thank you Erel for your answer.
But how can we explain that a public playstore program success to give a correct altitude on any smartphone, and not me under B4A ?

I tried to make work correctely my app using all the examples of the forum, but without result.

I am ready to learn any adviced method.
 

emexes

Well-Known Member
Licensed User
Are you using GPS OUTDOOR? It does not work INDOOR or at least very bad.
Thanks...NO of course !
Don Manfred asked: Are you using GPS OUTDOOR?
You replied: NO

which, thanks to the vagaries of English, could be interpreted as using GPS either indoors or outdoors, depending on what "of course !" means.

So, just to sure:

Are you using GPS OUTDOOR?

[ ] Yes, I can see the sky above me (and ideally most of the sky in all directions, unobstructed by trees or buildings)
[ ] No, I cannot see the sky above me
 

emexes

Well-Known Member
Licensed User
From Playstore i loaded an app named "GPS STATUS".
When I looked this up via web Playstore yesterday (was away from office, only had iPhone with me) I found one matching app, called "GPS Status & Toolbox", and the screenshots looked like it was showing numbers from GPS (eg, not from barometer sensor).

But because the issue hasn't been resolved, I figured I'd load up the app on to a phone here, and now I see there are a host of other apps called GPS Status, so I am wondering which one you are using, eg:

upload_2019-9-13_0-15-50.png
 
Last edited:

emexes

Well-Known Member
Licensed User
I figured I'd load up the app on to a phone here
I thought I'd try every app called "GPS Status" while waiting to find out precisely which app you're using, but... scratch that plan, there's too many of 'em:

GPS status, by khaled habbachi
GPS Status, by Jean-Pierre 'JeeP' Cheney
GPS Status, by I.P. Knightly
GPS Status, by lhoer0
GPS Status, by Pizza Entertainment
GPS status, by leovsstella
GPS Status, by David Ameller

GPS Status & Toolbox, by EclipSim
GPS status & Weather, by khaled habbachi
GPS status & Surveying tools, by ThSoft Co.,Ltd
GPS Status Widget Free, by K. Welsing
GPS Status PRO - (legacy key), by EclipSim
GPS Status - notification proxy plugin, by EclipSim

GPStatus: Realtime GPS Status, by JimO
GPS-Status Data: Signal,Radars, by Simple Soft Alliance

SkyPro GPS Status Tool, by Dual Electronics Corp.
GPS Test, GPS Status & Satfinder, by Facelover
Satellite Check - GPS Status, by DS Software
GPSstats - GPS status and sensors without internet, by JPG Funprograms
PPM Commander - GPS status, by PilaBlu
GPS tool Box and GPS status, by Fruitfull Apps
GPS Test and Status, by Hot Android Apps & Tools
 

DOM85

Active Member
Licensed User
When I looked this up via web Playstore yesterday (was away from office, only had iPhone with me) I found one matching app, called "GPS Status & Toolbox", and the screenshots looked like it was showing numbers from GPS (eg, not from barometer sensor).

But because the issue hasn't been resolved, I figured I'd load up the app on to a phone here, and now I see there are a host of other apps called GPS Status, so I am wondering which one you are using, eg:

View attachment 83828
Tnank you for your help.
1 - You are right, my answer was wrong, at the opposite of what i wanted to answer.
I use the GPS OUTDOOR. I use GPS since 17 years, by only decoding NMEA sentences with microontroller in machine code. I know rather well the conditions for use GPS.

2 - You are right again about the name of the Playstore App. It is GPS STATUS & TOOLBOX (not in pro mode).

I appreciate great your try to help me.
 

emexes

Well-Known Member
Licensed User
As I understand it, you have four Android phones, and when you have them outside next to each other:

with your B4A app, you get two different altitudes 12, 66, 66 and 66 (perhaps the 66 readings are 66 +/- a few metres)
with GPS Status & Toolbox app, you get four identical readings 66, 66, 66 and 66

and your actual elevation at your location is about 66 metres.

First question: are the GPS Status & Toolbox app readings identical (which suggests that it is looking up the land elevation at your currrent location) or do they also vary slightly eg +/- a few metres (which is entirely normal for GPS, suggesting that all four phones' GPS chips are getting the correct altitude).

Second question: given that only one of the four phones is returning an abnormal altitude, what is different about that phone? Is it set to high accuracy in the settings? Have you ever used a location spoofer on that phone? Perhaps try this app to reset the GPS to standard:

https://play.google.com/store/apps/details?id=com.discipleskies.gpsreset
 

DOM85

Active Member
Licensed User
If you're comfortable with NMEA, then perhaps handle the altitude sentences via this event:

(which I didn't know about - every day in this forum, I learn something new!)
I used it. I made a small app to decode all the NMEA sentences.
It seemed that some sentences were not received by my app using GPS library, and then with GNSS library.
I tried under old and recent release of B4A with a same result.

My main app is important. But it is now on stand-bye.
 
Status
Not open for further replies.
Top