Example usage for android.location GnssStatus usedInFix

List of usage examples for android.location GnssStatus usedInFix

Introduction

In this page you can find the example usage for android.location GnssStatus usedInFix.

Prototype

public boolean usedInFix(int satIndex) 

Source Link

Document

Reports whether the satellite at the specified index was used in the calculation of the most recent position fix.

Usage

From source file:com.android.gpstest.GpsSatelliteFragment.java

@RequiresApi(api = Build.VERSION_CODES.N)
private void updateGnssStatus(GnssStatus status) {
    setStarted(true);/*from www .j a v  a 2 s.  c om*/

    mSnrCn0Title = mRes.getString(R.string.gps_cn0_column_label);

    if (mPrns == null) {
        /**
         * We need to allocate arrays big enough so we don't overflow them.  Per
         * https://developer.android.com/reference/android/location/GnssStatus.html#getSvid(int)
         * 255 should be enough to contain all known satellites world-wide.
         */
        final int MAX_LENGTH = 255;
        mPrns = new int[MAX_LENGTH];
        mSnrCn0s = new float[MAX_LENGTH];
        mSvElevations = new float[MAX_LENGTH];
        mSvAzimuths = new float[MAX_LENGTH];
        mConstellationType = new int[MAX_LENGTH];
        mHasEphemeris = new boolean[MAX_LENGTH];
        mHasAlmanac = new boolean[MAX_LENGTH];
        mUsedInFix = new boolean[MAX_LENGTH];
    }

    final int length = status.getSatelliteCount();
    mSvCount = 0;
    mUsedInFixCount = 0;
    while (mSvCount < length) {
        int prn = status.getSvid(mSvCount);
        mPrns[mSvCount] = prn;
        mConstellationType[mSvCount] = status.getConstellationType(mSvCount);
        mSnrCn0s[mSvCount] = status.getCn0DbHz(mSvCount);
        mSvElevations[mSvCount] = status.getElevationDegrees(mSvCount);
        mSvAzimuths[mSvCount] = status.getAzimuthDegrees(mSvCount);
        mHasEphemeris[mSvCount] = status.hasEphemerisData(mSvCount);
        mHasAlmanac[mSvCount] = status.hasAlmanacData(mSvCount);
        mUsedInFix[mSvCount] = status.usedInFix(mSvCount);
        if (status.usedInFix(mSvCount)) {
            mUsedInFixCount++;
        }

        mSvCount++;
    }

    mAdapter.notifyDataSetChanged();
}