6.3.1.6.6. GpsEventSource

public class GpsEventSource

6.3.1.6.6.1. Fields

6.3.1.6.6.1.1. GPS_PROVIDER

public static final int GPS_PROVIDER

6.3.1.6.6.1.2. NETWORK_PROVIDER

public static final int NETWORK_PROVIDER

6.3.1.6.6.1.3. TWO_MINUTES

protected static final int TWO_MINUTES

6.3.1.6.6.1.4. mContext

protected Context mContext

6.3.1.6.6.1.5. mCurrentBestLocation

protected Location mCurrentBestLocation

6.3.1.6.6.1.6. mGpsLocationListener

protected GpsLocationListener mGpsLocationListener

6.3.1.6.6.1.7. mGpsStatusListener

protected GpsStatusListener mGpsStatusListener

6.3.1.6.6.1.8. mHasGPSFix

protected boolean mHasGPSFix

6.3.1.6.6.1.9. mLastLocation

protected Location mLastLocation

6.3.1.6.6.1.10. mListenProviders

protected int mListenProviders

6.3.1.6.6.1.11. mListeners

protected Queue<GpsEventListener> mListeners

6.3.1.6.6.1.12. mLocationManager

protected LocationManager mLocationManager

6.3.1.6.6.1.13. mUpdateMinDistance

protected float mUpdateMinDistance

6.3.1.6.6.1.14. mUpdateMinTime

protected long mUpdateMinTime

6.3.1.6.6.2. Constructors

6.3.1.6.6.2.1. GpsEventSource

public GpsEventSource(Context context)

6.3.1.6.6.3. Methods

6.3.1.6.6.3.1. addListener

public void addListener(GpsEventListener listener)

Add new listener for GPS events. You will likely want to call addListener() from your Activity’s or Fragment’s onResume() method, to enable the features. Remember to call the corresponding removeListener() in your Activity’s or Fragment’s onPause() method, to prevent unnecessary use of the battery.

Parameters:
  • listener – A listener class implements GpsEventListener adding to listeners array

6.3.1.6.6.3.2. getLastKnownBestLocation

public Location getLastKnownBestLocation()

6.3.1.6.6.3.3. getLastKnownLocation

public Location getLastKnownLocation()

6.3.1.6.6.3.4. isBetterLocation

protected boolean isBetterLocation(Location location, Location currentBestLocation)

Determines whether one Location reading is better than the current Location fix

Parameters:
  • location – The new Location that you want to evaluate
  • currentBestLocation – The current Location fix, to which you want to compare the new one

6.3.1.6.6.3.5. isSameProvider

protected boolean isSameProvider(String provider1, String provider2)

Checks whether two providers are the same

6.3.1.6.6.3.6. removeListener

public void removeListener(GpsEventListener listener)

Remove listener from listeners of GPS events. You will likely want to call removeListener() from your Activity’s or Fragment’s onPause() method, to prevent unnecessary use of the battery. Remember to call the corresponding addListener() in your Activity’s or Fragment’s onResume() method.

Parameters:
  • listener – A listener class implements GpsEventListener removing from listeners array

6.3.1.6.6.3.7. updateActiveListeners

public void updateActiveListeners()