Skip to content

Most visited

Recently visited

navigation

GnssMeasurement

public final class GnssMeasurement
extends Object implements Parcelable

java.lang.Object
   ↳ android.location.GnssMeasurement


A class representing a GNSS satellite measurement, containing raw and computed information.

Summary

Constants

int ADR_STATE_CYCLE_SLIP

The state of the 'Accumulated Delta Range' has a cycle slip detected.

int ADR_STATE_RESET

The state of the 'Accumulated Delta Range' has detected a reset.

int ADR_STATE_UNKNOWN

The state of the 'Accumulated Delta Range' is invalid or unknown.

int ADR_STATE_VALID

The state of the 'Accumulated Delta Range' is valid.

int MULTIPATH_INDICATOR_DETECTED

The measurement shows signs of multi-path.

int MULTIPATH_INDICATOR_NOT_DETECTED

The measurement shows no signs of multi-path.

int MULTIPATH_INDICATOR_UNKNOWN

The indicator is not available or the presence or absence of multipath is unknown.

int STATE_BDS_D2_BIT_SYNC

This Beidou measurement's tracking state has D2 bit sync.

int STATE_BDS_D2_SUBFRAME_SYNC

This Beidou measurement's tracking state has D2 sub-frame sync.

int STATE_BIT_SYNC

This GNSS measurement's tracking state has bit sync.

int STATE_CODE_LOCK

This GNSS measurement's tracking state has code lock.

int STATE_GAL_E1BC_CODE_LOCK

This Galileo measurement's tracking state has E1B/C code lock.

int STATE_GAL_E1B_PAGE_SYNC

This Galileo measurement's tracking state has E1B page sync.

int STATE_GAL_E1C_2ND_CODE_LOCK

This Galileo measurement's tracking state has E1C secondary code lock.

int STATE_GLO_STRING_SYNC

This Glonass measurement's tracking state has string sync.

int STATE_GLO_TOD_DECODED

This Glonass measurement's tracking state has time-of-day decoded.

int STATE_GLO_TOD_KNOWN

This Glonass measurement's tracking state has time-of-day known, possibly not decoded over the air but has been determined from other sources.

int STATE_MSEC_AMBIGUOUS

This GNSS measurement's tracking state contains millisecond ambiguity.

int STATE_SBAS_SYNC

This SBAS measurement's tracking state has whole second level sync.

int STATE_SUBFRAME_SYNC

This GNSS measurement's tracking state has sub-frame sync.

int STATE_SYMBOL_SYNC

This GNSS measurement's tracking state has symbol sync.

int STATE_TOW_DECODED

This GNSS measurement's tracking state has time-of-week decoded.

int STATE_TOW_KNOWN

This GNSS measurement's tracking state has time-of-week known, possibly not decoded over the air but has been determined from other sources.

int STATE_UNKNOWN

This GNSS measurement's tracking state is invalid or unknown.

Inherited constants

From interface android.os.Parcelable

Fields

public static final Creator<GnssMeasurement> CREATOR

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

double getAccumulatedDeltaRangeMeters()

Gets the accumulated delta range since the last channel reset, in meters.

int getAccumulatedDeltaRangeState()

Gets 'Accumulated Delta Range' state.

double getAccumulatedDeltaRangeUncertaintyMeters()

Gets the accumulated delta range's uncertainty (1-Sigma) in meters.

double getAutomaticGainControlLevelDb()

Gets the Automatic Gain Control level in dB.

long getCarrierCycles()

The number of full carrier cycles between the satellite and the receiver.

float getCarrierFrequencyHz()

Gets the carrier frequency of the tracked signal.

double getCarrierPhase()

Gets the RF phase detected by the receiver.

double getCarrierPhaseUncertainty()

Gets the carrier-phase's uncertainty (1-Sigma).

double getCn0DbHz()

Gets the Carrier-to-noise density in dB-Hz.

int getConstellationType()

Gets the constellation type.

int getMultipathIndicator()

Gets a value indicating the 'multipath' state of the event.

double getPseudorangeRateMetersPerSecond()

Gets the Pseudorange rate at the timestamp in m/s.

double getPseudorangeRateUncertaintyMetersPerSecond()

Gets the pseudorange's rate uncertainty (1-Sigma) in m/s.

long getReceivedSvTimeNanos()

Gets the received GNSS satellite time, at the measurement time, in nanoseconds.

long getReceivedSvTimeUncertaintyNanos()

Gets the error estimate (1-sigma) for the received GNSS time, in nanoseconds.

double getSnrInDb()

Gets the Signal-to-Noise ratio (SNR) in dB.

int getState()

Gets per-satellite sync state.

int getSvid()

Gets the satellite ID.

double getTimeOffsetNanos()

Gets the time offset at which the measurement was taken in nanoseconds.

boolean hasAutomaticGainControlLevelDb()

Returns true if getAutomaticGainControlLevelDb() is available, false otherwise.

boolean hasCarrierCycles()

Returns true if getCarrierCycles() is available, false otherwise.

boolean hasCarrierFrequencyHz()

Returns true if getCarrierFrequencyHz() is available, false otherwise.

boolean hasCarrierPhase()

Returns true if getCarrierPhase() is available, false otherwise.

boolean hasCarrierPhaseUncertainty()

Returns true if getCarrierPhaseUncertainty() is available, false otherwise.

boolean hasSnrInDb()

Returns true if getSnrInDb() is available, false otherwise.

String toString()

Returns a string representation of the object.

void writeToParcel(Parcel parcel, int flags)

Flatten this object in to a Parcel.

Inherited methods

From class java.lang.Object
From interface android.os.Parcelable

Constants

ADR_STATE_CYCLE_SLIP

added in API level 24
int ADR_STATE_CYCLE_SLIP

The state of the 'Accumulated Delta Range' has a cycle slip detected.

Constant Value: 4 (0x00000004)

ADR_STATE_RESET

added in API level 24
int ADR_STATE_RESET

The state of the 'Accumulated Delta Range' has detected a reset.

Constant Value: 2 (0x00000002)

ADR_STATE_UNKNOWN

added in API level 24
int ADR_STATE_UNKNOWN

The state of the 'Accumulated Delta Range' is invalid or unknown.

Constant Value: 0 (0x00000000)

ADR_STATE_VALID

added in API level 24
int ADR_STATE_VALID

The state of the 'Accumulated Delta Range' is valid.

Constant Value: 1 (0x00000001)

MULTIPATH_INDICATOR_DETECTED

added in API level 24
int MULTIPATH_INDICATOR_DETECTED

The measurement shows signs of multi-path.

Constant Value: 1 (0x00000001)

MULTIPATH_INDICATOR_NOT_DETECTED

added in API level 24
int MULTIPATH_INDICATOR_NOT_DETECTED

The measurement shows no signs of multi-path.

Constant Value: 2 (0x00000002)

MULTIPATH_INDICATOR_UNKNOWN

added in API level 24
int MULTIPATH_INDICATOR_UNKNOWN

The indicator is not available or the presence or absence of multipath is unknown.

Constant Value: 0 (0x00000000)

STATE_BDS_D2_BIT_SYNC

added in API level 24
int STATE_BDS_D2_BIT_SYNC

This Beidou measurement's tracking state has D2 bit sync.

Constant Value: 256 (0x00000100)

STATE_BDS_D2_SUBFRAME_SYNC

added in API level 24
int STATE_BDS_D2_SUBFRAME_SYNC

This Beidou measurement's tracking state has D2 sub-frame sync.

Constant Value: 512 (0x00000200)

STATE_BIT_SYNC

added in API level 24
int STATE_BIT_SYNC

This GNSS measurement's tracking state has bit sync.

Constant Value: 2 (0x00000002)

STATE_CODE_LOCK

added in API level 24
int STATE_CODE_LOCK

This GNSS measurement's tracking state has code lock.

Constant Value: 1 (0x00000001)

STATE_GAL_E1BC_CODE_LOCK

added in API level 24
int STATE_GAL_E1BC_CODE_LOCK

This Galileo measurement's tracking state has E1B/C code lock.

Constant Value: 1024 (0x00000400)

STATE_GAL_E1B_PAGE_SYNC

added in API level 24
int STATE_GAL_E1B_PAGE_SYNC

This Galileo measurement's tracking state has E1B page sync.

Constant Value: 4096 (0x00001000)

STATE_GAL_E1C_2ND_CODE_LOCK

added in API level 24
int STATE_GAL_E1C_2ND_CODE_LOCK

This Galileo measurement's tracking state has E1C secondary code lock.

Constant Value: 2048 (0x00000800)

STATE_GLO_STRING_SYNC

added in API level 24
int STATE_GLO_STRING_SYNC

This Glonass measurement's tracking state has string sync.

Constant Value: 64 (0x00000040)

STATE_GLO_TOD_DECODED

added in API level 24
int STATE_GLO_TOD_DECODED

This Glonass measurement's tracking state has time-of-day decoded.

Constant Value: 128 (0x00000080)

STATE_GLO_TOD_KNOWN

added in API level 26
int STATE_GLO_TOD_KNOWN

This Glonass measurement's tracking state has time-of-day known, possibly not decoded over the air but has been determined from other sources. If TOD decoded is set then TOD Known will also be set.

Constant Value: 32768 (0x00008000)

STATE_MSEC_AMBIGUOUS

added in API level 24
int STATE_MSEC_AMBIGUOUS

This GNSS measurement's tracking state contains millisecond ambiguity.

Constant Value: 16 (0x00000010)

STATE_SBAS_SYNC

added in API level 24
int STATE_SBAS_SYNC

This SBAS measurement's tracking state has whole second level sync.

Constant Value: 8192 (0x00002000)

STATE_SUBFRAME_SYNC

added in API level 24
int STATE_SUBFRAME_SYNC

This GNSS measurement's tracking state has sub-frame sync.

Constant Value: 4 (0x00000004)

STATE_SYMBOL_SYNC

added in API level 24
int STATE_SYMBOL_SYNC

This GNSS measurement's tracking state has symbol sync.

Constant Value: 32 (0x00000020)

STATE_TOW_DECODED

added in API level 24
int STATE_TOW_DECODED

This GNSS measurement's tracking state has time-of-week decoded.

Constant Value: 8 (0x00000008)

STATE_TOW_KNOWN

added in API level 26
int STATE_TOW_KNOWN

This GNSS measurement's tracking state has time-of-week known, possibly not decoded over the air but has been determined from other sources. If TOW decoded is set then TOW Known will also be set.

Constant Value: 16384 (0x00004000)

STATE_UNKNOWN

added in API level 24
int STATE_UNKNOWN

This GNSS measurement's tracking state is invalid or unknown.

Constant Value: 0 (0x00000000)

Fields

CREATOR

added in API level 24
Creator<GnssMeasurement> CREATOR

Public methods

describeContents

added in API level 24
int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(Parcel, int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.

getAccumulatedDeltaRangeMeters

added in API level 24
double getAccumulatedDeltaRangeMeters ()

Gets the accumulated delta range since the last channel reset, in meters.

The error estimate for this value is getAccumulatedDeltaRangeUncertaintyMeters().

The availability of the value is represented by getAccumulatedDeltaRangeState().

A positive value indicates that the SV is moving away from the receiver. The sign of getAccumulatedDeltaRangeMeters() and its relation to the sign of getCarrierPhase() is given by the equation:

          accumulated delta range = -k * carrier phase    (where k is a constant)

Returns
double

getAccumulatedDeltaRangeState

added in API level 24
int getAccumulatedDeltaRangeState ()

Gets 'Accumulated Delta Range' state.

It indicates whether getAccumulatedDeltaRangeMeters() is reset or there is a cycle slip (indicating 'loss of lock').

Returns
int

getAccumulatedDeltaRangeUncertaintyMeters

added in API level 24
double getAccumulatedDeltaRangeUncertaintyMeters ()

Gets the accumulated delta range's uncertainty (1-Sigma) in meters.

The uncertainty is represented as an absolute (single sided) value.

The status of the value is represented by getAccumulatedDeltaRangeState().

Returns
double

getAutomaticGainControlLevelDb

added in API level 26
double getAutomaticGainControlLevelDb ()

Gets the Automatic Gain Control level in dB.

AGC acts as a variable gain amplifier adjusting the power of the incoming signal. The AGC level may be used to indicate potential interference. When AGC is at a nominal level, this value must be set as 0. Higher gain (and/or lower input power) shall be output as a positive number. Hence in cases of strong jamming, in the band of this signal, this value will go more negative.

Note: Different hardware designs (e.g. antenna, pre-amplification, or other RF HW components) may also affect the typical output of of this value on any given hardware design in an open sky test - the important aspect of this output is that changes in this value are indicative of changes on input signal power in the frequency band for this measurement.

The value is only available if hasAutomaticGainControlLevelDb() is true

Returns
double

getCarrierCycles

added in API level 24
long getCarrierCycles ()

The number of full carrier cycles between the satellite and the receiver.

The reference frequency is given by the value of getCarrierFrequencyHz().

The value is only available if hasCarrierCycles() is true.

Returns
long

getCarrierFrequencyHz

added in API level 24
float getCarrierFrequencyHz ()

Gets the carrier frequency of the tracked signal.

For example it can be the GPS central frequency for L1 = 1575.45 MHz, or 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 raw measurement objects will be reported for this same satellite, in one of the measurement objects, 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() is true.

Returns
float the carrier frequency of the signal tracked in Hz.

getCarrierPhase

added in API level 24
double getCarrierPhase ()

Gets the RF phase detected by the receiver.

Range: [0.0, 1.0].

This is the fractional part of the complete carrier phase measurement.

The reference frequency is given by the value of getCarrierFrequencyHz().

The error estimate for this value is getCarrierPhaseUncertainty().

The value is only available if hasCarrierPhase() is true.

Returns
double

getCarrierPhaseUncertainty

added in API level 24
double getCarrierPhaseUncertainty ()

Gets the carrier-phase's uncertainty (1-Sigma).

The uncertainty is represented as an absolute (single sided) value.

The value is only available if hasCarrierPhaseUncertainty() is true.

Returns
double

getCn0DbHz

added in API level 24
double getCn0DbHz ()

Gets the Carrier-to-noise density in dB-Hz.

Typical range: 10-50 db-Hz.

The value contains the measured C/N0 for the signal at the antenna input.

Returns
double

getConstellationType

added in API level 24
int getConstellationType ()

Gets the constellation type.

The return value is one of those constants with CONSTELLATION_ prefix in GnssStatus.

Returns
int

getMultipathIndicator

added in API level 24
int getMultipathIndicator ()

Gets a value indicating the 'multipath' state of the event.

Returns
int

getPseudorangeRateMetersPerSecond

added in API level 24
double getPseudorangeRateMetersPerSecond ()

Gets the Pseudorange rate at the timestamp in m/s.

The error estimate for this value is getPseudorangeRateUncertaintyMetersPerSecond().

The value is uncorrected, i.e. corrections for receiver and satellite clock frequency errors are not included.

A positive 'uncorrected' value indicates that the SV is moving away from the receiver. The sign of the 'uncorrected' 'pseudorange rate' and its relation to the sign of 'doppler shift' is given by the equation:

      pseudorange rate = -k * doppler shift   (where k is a constant)

Returns
double

getPseudorangeRateUncertaintyMetersPerSecond

added in API level 24
double getPseudorangeRateUncertaintyMetersPerSecond ()

Gets the pseudorange's rate uncertainty (1-Sigma) in m/s.

The uncertainty is represented as an absolute (single sided) value.

Returns
double

getReceivedSvTimeNanos

added in API level 24
long getReceivedSvTimeNanos ()

Gets the received GNSS satellite time, at the measurement time, in nanoseconds.

For GPS & QZSS, this is:

  • Received GPS Time-of-Week at the measurement time, in nanoseconds.
  • The value is relative to the beginning of the current GPS week.

Given the highest sync state that can be achieved, per each satellite, valid range for this field can be:

     Searching       : [ 0       ]   : STATE_UNKNOWN
     C/A code lock   : [ 0   1ms ]   : STATE_CODE_LOCK is set
     Bit sync        : [ 0  20ms ]   : STATE_BIT_SYNC is set
     Subframe sync   : [ 0    6s ]   : STATE_SUBFRAME_SYNC is set
     TOW decoded     : [ 0 1week ]   : STATE_TOW_DECODED is set
     TOW Known       : [ 0 1week ]   : STATE_TOW_KNOWN set
Note: TOW Known refers to the case where TOW is possibly not decoded over the air but has been determined from other sources. If TOW decoded is set then TOW Known must also be set.

Note well: if there is any ambiguity in integer millisecond, STATE_MSEC_AMBIGUOUS must be set accordingly, in the 'state' field.

This value must be populated if 'state' != STATE_UNKNOWN.

For Glonass, this is:

  • Received Glonass time of day, at the measurement time in nanoseconds.

Given the highest sync state that can be achieved, per each satellite, valid range for this field can be:

     Searching           : [ 0       ]   : STATE_UNKNOWN
     C/A code lock       : [ 0   1ms ]   : STATE_CODE_LOCK is set
     Symbol sync         : [ 0  10ms ]   : STATE_SYMBOL_SYNC is set
     Bit sync            : [ 0  20ms ]   : STATE_BIT_SYNC is set
     String sync         : [ 0    2s ]   : STATE_GLO_STRING_SYNC is set
     Time of day decoded : [ 0  1day ]   : STATE_GLO_TOD_DECODED is set
     Time of day known   : [ 0  1day ]   : STATE_GLO_TOD_KNOWN set
Note: Time of day known refers to the case where it is possibly not decoded over the air but has been determined from other sources. If Time of day decoded is set then Time of day known must also be set.

For Beidou, this is:

  • Received Beidou time of week, at the measurement time in nanoseconds.

Given the highest sync state that can be achieved, per each satellite, valid range for this field can be:

     Searching              : [ 0       ]   : STATE_UNKNOWN
     C/A code lock          : [ 0   1ms ]   : STATE_CODE_LOCK is set
     Bit sync (D2)          : [ 0   2ms ]   : STATE_BDS_D2_BIT_SYNC is set
     Bit sync (D1)          : [ 0  20ms ]   : STATE_BIT_SYNC is set
     Subframe (D2)          : [ 0  0.6s ]   : STATE_BDS_D2_SUBFRAME_SYNC is set
     Subframe (D1)          : [ 0    6s ]   : STATE_SUBFRAME_SYNC is set
     Time of week decoded   : [ 0 1week ]   : STATE_TOW_DECODED is set
     Time of week known     : [ 0 1week ]   : STATE_TOW_KNOWN set
Note: TOW Known refers to the case where TOW is possibly not decoded over the air but has been determined from other sources. If TOW decoded is set then TOW Known must also be set.

For Galileo, this is:

  • Received Galileo time of week, at the measurement time in nanoseconds.
     E1BC code lock       : [ 0   4ms ]  : STATE_GAL_E1BC_CODE_LOCK is set
     E1C 2nd code lock    : [ 0 100ms ]  : STATE_GAL_E1C_2ND_CODE_LOCK is set
     E1B page             : [ 0    2s ]  : STATE_GAL_E1B_PAGE_SYNC is set
     Time of week decoded : [ 0 1week ]  : STATE_GAL_TOW_DECODED is set
     Time of week known   : [ 0 1week ]  : STATE_GAL_TOW_KNOWN set
Note: TOW Known refers to the case where TOW is possibly not decoded over the air but has been determined from other sources. If TOW decoded is set then TOW Known must also be set.

For SBAS, this is:

  • Received SBAS time, at the measurement time in nanoseconds.

Given the highest sync state that can be achieved, per each satellite, valid range for this field can be:

     Searching       : [ 0       ]   : STATE_UNKNOWN
     C/A code lock   : [ 0   1ms ]   : STATE_CODE_LOCK is set
     Symbol sync     : [ 0   2ms ]   : STATE_SYMBOL_SYNC is set
     Message         : [ 0    1s ]   : STATE_SBAS_SYNC is set

Returns
long

getReceivedSvTimeUncertaintyNanos

added in API level 24
long getReceivedSvTimeUncertaintyNanos ()

Gets the error estimate (1-sigma) for the received GNSS time, in nanoseconds.

Returns
long

getSnrInDb

added in API level 24
double getSnrInDb ()

Gets the Signal-to-Noise ratio (SNR) in dB.

The value is only available if hasSnrInDb() is true.

Returns
double

getState

added in API level 24
int getState ()

Gets per-satellite sync state.

It represents the current sync state for the associated satellite.

This value helps interpret getReceivedSvTimeNanos().

Returns
int

getSvid

added in API level 24
int getSvid ()

Gets the satellite ID.

Interpretation depends on getConstellationType(). See getSvid(int).

Returns
int

getTimeOffsetNanos

added in API level 24
double getTimeOffsetNanos ()

Gets the time offset at which the measurement was taken in nanoseconds.

The reference receiver's time from which this is offset is specified by getTimeNanos().

The sign of this value is given by the following equation:

      measurement time = TimeNanos + TimeOffsetNanos

The value provides an individual time-stamp for the measurement, and allows sub-nanosecond accuracy.

Returns
double

hasAutomaticGainControlLevelDb

added in API level 26
boolean hasAutomaticGainControlLevelDb ()

Returns true if getAutomaticGainControlLevelDb() is available, false otherwise.

Returns
boolean

hasCarrierCycles

added in API level 24
boolean hasCarrierCycles ()

Returns true if getCarrierCycles() is available, false otherwise.

Returns
boolean

hasCarrierFrequencyHz

added in API level 24
boolean hasCarrierFrequencyHz ()

Returns true if getCarrierFrequencyHz() is available, false otherwise.

Returns
boolean

hasCarrierPhase

added in API level 24
boolean hasCarrierPhase ()

Returns true if getCarrierPhase() is available, false otherwise.

Returns
boolean

hasCarrierPhaseUncertainty

added in API level 24
boolean hasCarrierPhaseUncertainty ()

Returns true if getCarrierPhaseUncertainty() is available, false otherwise.

Returns
boolean

hasSnrInDb

added in API level 24
boolean hasSnrInDb ()

Returns true if getSnrInDb() is available, false otherwise.

Returns
boolean

toString

added in API level 24
String toString ()

Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
String a string representation of the object.

writeToParcel

added in API level 24
void writeToParcel (Parcel parcel, 
                int flags)

Flatten this object in to a Parcel.

Parameters
parcel Parcel: The Parcel in which the object should be written.

flags int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)