Android Question GPS Raw Data

solfinker

Member
Licensed User
Longtime User
How can I read GPS raw data?
I need GPS information in RINEX format, that is, measurements from several satellite constellations.

Thank you.
 

DonManfred

Expert
Licensed User
Longtime User
GPS does not allow (as far as i know) to select specific Satellites.
I think this is not possible. I may be wrong though.

I don´t know if it is possible to get raw-data as GPS is an Android-Feature. We only get a new Location trough Events.

Maybe this (found in forum)?
B4X:
Public Sub Initialize
    MyGPS.Initialize("MyGPS")
    If MyGPS.GPSEnabled = False Then
        StartActivity(MyGPS.LocationSettingsIntent) 'Will open the relevant settings screen.
    Else
        MyGPS.Start(0, 0)
    End If
End Sub

Public Sub Destroy()
    MyGPS.Stop
End Sub

Private Sub MyGPS_NMEA (TimeStamp As Long, Sentence As String)
   Log(Sentence)
End Sub
 
Last edited:
Upvote 0

agraham

Expert
Licensed User
Longtime User
The most detailed information on individual satellites that can presently be obtained in B4A is by using my GNSS library which is a superset of the GPS library.
It will give you this data for each satellite though this is probably not what you want.
Returns the satellite azimuth in degrees (0 - 360).
Azimuth(int satIndex)

Gets the carrier frequency of the signal tracked.
For example it can be the GPS central frequency
* L1 = 1575.45 MHz, L2 = 1227.60 MHz, L5 = 1176.45 MHz, varying GLO channels, etc.
If the field is not set, it is the primary common use central frequency, e.g. L1 = 1575.45 MHz for GPS.
For an L1, L5 receiver tracking a satellite on L1 and L5 at the same time, two measurements will be reported for this same satellite,
in one all the values related to L1 will be filled, and in the other all of the values related to L5 will be filled.
The value is only available if hasCarrierFrequencyHz(int) is true.
CarrierFrequencyHz(int satIndex)

Retrieves the carrier-to-noise density in dB-Hz at the antenna of the satellite at the specified index.
Cn0DbHz(int satIndex)

Retrieves the constellation type of the satellite at the specified index.
Compare this with one of the CONSTELLATION constants to identify the constellation.
ConstellationType(int satIndex)

Returns the satellite elevation in degrees (0 - 90).
Elevation(int satIndex)

Reports whether the satellite at the specified index has almanac data.
HasAlmanacData(int satIndex)

Reports whether a valid CarrierFrequency is available for the satellite at the specified index.
HasCarrierFrequencyHz(int satIndex)

Reports whether the satellite at the specified index has ephemeris data.
HasEphemerisData(int satIndex

Gets the identification number for the satellite at the specific index.
This svid is the pseudo-random number for most constellations. It is FCN and OSN number for Glonass.
The distinction is made by looking at ConstellationType. Expected values are in the range of:
GPS: 1-32
SBAS: 120-151, 183-192
GLONASS: One of: OSN or FCN+100
1-24 as the orbital slot number (OSN) (preferred, if known)
93-106 as the frequency channel number (FCN) (-7 to +6) plus 100. i.e FCN of -7 is 93, 0 is 100, and +6 is 106
QZSS: 193-200
Galileo: 1-36
Beidou: 1-37
Svid(int satIndex)

Tests whether the satellite at the specified index was used to calculate the most recent fix.
UsedInFix(int satIndex)
 
Upvote 0

solfinker

Member
Licensed User
Longtime User
Thank you.
You say that
Reports whether the satellite at the specified index has ephemeris data.
HasEphemerisData(int satIndex)

but, do we get the ephemeris data?
 
Upvote 0

solfinker

Member
Licensed User
Longtime User
I came across this infographic


API_ android.location.png



referring to differences between Marshmallow and Nougat and purports to explain that we do now have no black box but the raw data themselves, which I suppose is wrong since I found GnssStatus which is exactly what you explained.
It contains, therefore, the following Public methods
describeContents()
equals()
getAzimuthDegrees()
getBasebandCn0DbHz()
getCarrierFrequaencyHz()
getCn0DbHz
getConstellationType()
getElevationDegrees()
getSatelliteCount()
getSvid()
hasAlmanacData()
hasBasebandCn0DbHz()
hasCarrierFrequencyHz()
hasEphemerisData()
hashCode()
usedInFix()
writeToParcel()

And no ephemeris data.

Thank you again.
 
Upvote 0

Lakhtin_V

Active Member
Licensed User
Longtime User
The most detailed information on individual satellites that can presently be obtained in B4A is by using my GNSS library which is a superset of the GPS library.
It will give you this data for each satellite though this is probably not what you want.
Your library can solve my problem. I want to get the exact time from the GPS without using the system time. It is important for me to get the exact time to 1 millisecond. But the system time in android on different smartphones shows different times = - 1-5 seconds sometimes more. I hope that the time from the GPS on all devices located nearby in one place will be the same. As an option, is it possible to force Android to correct the internal clock according to the GPS all the time? because the time from cellular operators is less accurate.
I need to synchronize clocks on different devices with maximum accuracy
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
The only time available is the time of fix in the Location object passed to the LocationChange event. I doubt that this can be relied on as an indication of the current time. In fact, I doubt that you can reliably get 1mS precision on any timings in an Android app as all events are indeterminately invoked off the application message loop which stalls when any other event code is running as there is only the single main thread handling everything.
 
Upvote 0
Top