List of usage examples for android.location GpsStatus GPS_EVENT_STOPPED
int GPS_EVENT_STOPPED
To view the source code for android.location GpsStatus GPS_EVENT_STOPPED.
Click Source Link
From source file:com.android.gpstest.GpsSkyFragment.java
public void onGpsStatusChanged(int event, GpsStatus status) { switch (event) { case GpsStatus.GPS_EVENT_STARTED: mSkyView.setStarted();/*w w w . j a v a2 s .c o m*/ break; case GpsStatus.GPS_EVENT_STOPPED: mSkyView.setStopped(); break; case GpsStatus.GPS_EVENT_SATELLITE_STATUS: mSkyView.setSats(status); break; } }
From source file:org.mozilla.mozstumbler.service.stumblerthread.scanners.GPSScanner.java
private void startActiveMode() { LocationManager lm = getLocationManager(); if (!isGpsAvailable(lm)) { return;/*www . j a v a 2s . co m*/ } lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, ACTIVE_MODE_GPS_MIN_UPDATE_TIME_MS, ACTIVE_MODE_GPS_MIN_UPDATE_DISTANCE_M, this); reportLocationLost(); mGPSListener = new GpsStatus.Listener() { public void onGpsStatusChanged(int event) { if (event == GpsStatus.GPS_EVENT_SATELLITE_STATUS) { GpsStatus status = getLocationManager().getGpsStatus(null); Iterable<GpsSatellite> sats = status.getSatellites(); int satellites = 0; int fixes = 0; for (GpsSatellite sat : sats) { satellites++; if (sat.usedInFix()) { fixes++; } } if (fixes < MIN_SAT_USED_IN_FIX) { reportLocationLost(); } } else if (event == GpsStatus.GPS_EVENT_STOPPED) { reportLocationLost(); } } }; lm.addGpsStatusListener(mGPSListener); }
From source file:com.alexandreroman.nrelay.NmeaRelayService.java
@Override public void onGpsStatusChanged(int event) { if (GpsStatus.GPS_EVENT_STARTED == event) { Log.i(TAG, "GPS started"); } else if (GpsStatus.GPS_EVENT_STOPPED == event) { Log.i(TAG, "GPS stopped"); } else if (GpsStatus.GPS_EVENT_FIRST_FIX == event) { Log.i(TAG, "GPS first fix"); } else if (GpsStatus.GPS_EVENT_SATELLITE_STATUS == event) { if (locationManager != null) { final GpsStatus s = locationManager.getGpsStatus(null); context.satellitesInUse = 0; context.satellitesInView = 0; for (final GpsSatellite sat : s.getSatellites()) { if (sat.usedInFix()) { context.satellitesInUse += 1; }//from w w w . j ava 2s . c o m context.satellitesInView += 1; } if (BuildConfig.DEBUG) { Log.v(TAG, "GPS satellite status: " + context.satellitesInUse + " satellite(s) used in fix"); } fireNmeaRelayContextChanged(); } } }
From source file:com.android.gpstest.GpsStatusFragment.java
public void onGpsStatusChanged(int event, GpsStatus status) { switch (event) { case GpsStatus.GPS_EVENT_STARTED: setStarted(true);/* w ww. j a va 2s . c o m*/ break; case GpsStatus.GPS_EVENT_STOPPED: setStarted(false); break; case GpsStatus.GPS_EVENT_FIRST_FIX: break; case GpsStatus.GPS_EVENT_SATELLITE_STATUS: updateStatus(status); break; } }
From source file:org.destil.gpsaveraging.MainActivity.java
@SuppressWarnings("unused") @Override//from w w w .j a v a 2s .c o m public void onGpsStatusChanged(int status) { if (status == GpsStatus.GPS_EVENT_FIRST_FIX) { DisplayCoordsNoAveraging(); } else if (status == GpsStatus.GPS_EVENT_SATELLITE_STATUS) { GpsStatus gpsStatus = locationManager.getGpsStatus(null); int all = 0; Iterable<GpsSatellite> satellites = gpsStatus.getSatellites(); for (GpsSatellite satellite : satellites) { all++; } uiSatellites.setText(getString(R.string.satellites_info, all)); } else if (status == GpsStatus.GPS_EVENT_STOPPED) { showError(R.string.gps_not_available); } }
From source file:com.nextgis.maplibui.service.TrackerService.java
@Override public void onGpsStatusChanged(int event) { switch (event) { case GpsStatus.GPS_EVENT_STARTED: case GpsStatus.GPS_EVENT_STOPPED: mHasGPSFix = false;// w w w . jav a 2 s.com break; case GpsStatus.GPS_EVENT_FIRST_FIX: mHasGPSFix = true; break; case GpsStatus.GPS_EVENT_SATELLITE_STATUS: mSatellitesCount = 0; for (GpsSatellite sat : mLocationManager.getGpsStatus(null).getSatellites()) { if (sat.usedInFix()) { mSatellitesCount++; } } break; } }
From source file:com.shadowmaps.example.GpsTestActivity.java
public void onGpsStatusChanged(int event) { //Log.v("GpsTestActivity", "onGpsStatusChanged"); mStatus = mService.getGpsStatus(mStatus); switch (event) { case GpsStatus.GPS_EVENT_STARTED: break;//from w ww . j av a 2 s .co m case GpsStatus.GPS_EVENT_STOPPED: break; case GpsStatus.GPS_EVENT_FIRST_FIX: int ttff = mStatus.getTimeToFirstFix(); if (ttff == 0) { mTtff = ""; } else { ttff = (ttff + 500) / 1000; mTtff = Integer.toString(ttff) + " sec"; } break; case GpsStatus.GPS_EVENT_SATELLITE_STATUS: // Stop progress bar after the first status information is obtained setSupportProgressBarIndeterminateVisibility(Boolean.FALSE); break; } for (GpsTestListener listener : mGpsTestListeners) { listener.onGpsStatusChanged(event, mStatus); } }
From source file:com.landenlabs.all_devtool.GpsFragment.java
@Override public void onGpsStatusChanged(int event) { if (getActivity() != null) { final LocationManager locMgr = (LocationManager) getActivity() .getSystemService(Context.LOCATION_SERVICE); try {/*from w ww. jav a 2 s . co m*/ gpsStatus = locMgr.getGpsStatus(gpsStatus); String msg = ""; switch (event) { case GpsStatus.GPS_EVENT_STARTED: msg = "GPS event started"; break; case GpsStatus.GPS_EVENT_STOPPED: msg = "GPS event stopped"; break; case GpsStatus.GPS_EVENT_FIRST_FIX: msg = "GPS first fix"; break; case GpsStatus.GPS_EVENT_SATELLITE_STATUS: msg = "GPS sat status"; break; } if (TextUtils.isEmpty(msg)) { addMsgToDetailRow(s_colorGps, msg); GpsItem gpsItem = m_lastUpdates.get(STATUS_CB); if (gpsItem != null) { gpsItem.set(System.currentTimeMillis(), msg); listChanged(); } } showProviders(); } catch (SecurityException ex) { Log.e(TAG, ex.getMessage()); } } }
From source file:biz.bokhorst.bpt.BPTService.java
@Override public void onGpsStatusChanged(int event) { if (locating) if (event == GpsStatus.GPS_EVENT_SATELLITE_STATUS) { if (locationManager != null) { GpsStatus status = locationManager.getGpsStatus(null); if (status != null) { int fix = 0; int count = 0; Iterable<GpsSatellite> sats = status.getSatellites(); Iterator<GpsSatellite> satI = sats.iterator(); while (satI.hasNext()) { GpsSatellite gpssatellite = satI.next(); count++;//from ww w . jav a2 s . c om if (gpssatellite.usedInFix()) fix++; } sendSatellites(fix, count); } } } else { if (event == GpsStatus.GPS_EVENT_FIRST_FIX) sendStatus(getString(R.string.GpsFix)); else if (event == GpsStatus.GPS_EVENT_STARTED) sendStatus(getString(R.string.GpsStarted)); else if (event == GpsStatus.GPS_EVENT_STOPPED) sendStatus(getString(R.string.GpsStopped)); else sendStatus(String.format("Event %d", event)); } }
From source file:com.android.gpstest.GpsTestActivity.java
public void onGpsStatusChanged(int event) { mStatus = mService.getGpsStatus(mStatus); switch (event) { case GpsStatus.GPS_EVENT_STARTED: break;/*from ww w . j av a 2 s .c om*/ case GpsStatus.GPS_EVENT_STOPPED: break; case GpsStatus.GPS_EVENT_FIRST_FIX: int ttff = mStatus.getTimeToFirstFix(); if (ttff == 0) { mTtff = ""; } else { ttff = (ttff + 500) / 1000; mTtff = Integer.toString(ttff) + " sec"; } break; case GpsStatus.GPS_EVENT_SATELLITE_STATUS: // Stop progress bar after the first status information is obtained setSupportProgressBarIndeterminateVisibility(Boolean.FALSE); break; } // If the user is viewing the tutorial, we don't want to clutter the status screen, so return if (sv != null && sv.isShown()) { return; } for (GpsTestListener listener : mGpsTestListeners) { listener.onGpsStatusChanged(event, mStatus); } }