List of usage examples for android.location GpsStatus GPS_EVENT_STARTED
int GPS_EVENT_STARTED
To view the source code for android.location GpsStatus GPS_EVENT_STARTED.
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();//from www .ja va 2 s . c om break; case GpsStatus.GPS_EVENT_STOPPED: mSkyView.setStopped(); break; case GpsStatus.GPS_EVENT_SATELLITE_STATUS: mSkyView.setSats(status); break; } }
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 ava2 s. com*/ 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);/*from w ww . j a v a 2 s . 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: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;/*from w w w . ja v a 2 s. c o m*/ 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;// w w w. j a v a2s.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; } 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 {//w w w. ja v a 2 s .c o 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 w w w . j a va 2s . co m 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;// w w w . j a v a 2s .c o 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; } // 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); } }
From source file:it.trilogis.android.fao.WorldWindActivity.java
@Override public void onGpsStatusChanged(int event) { if (event == GpsStatus.GPS_EVENT_STARTED) { gpsIsOn = true;//from w ww .ja va 2 s .c o m gpsUpdate = true; startGPSTimer(); lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, gpsSeconds * 1000, gpsMeters, locationListener); if (null != gpsSettings && gpsSettings.isAdded()) { gpsSettings.dismiss(); } } }
From source file:com.androzic.location.LocationService.java
@Override public void onGpsStatusChanged(int event) { switch (event) { case GpsStatus.GPS_EVENT_STARTED: updateProvider(LocationManager.GPS_PROVIDER, true); updateGpsStatus(GPS_SEARCHING, 0, 0); break;//from w w w . j av a 2 s .c o m case GpsStatus.GPS_EVENT_FIRST_FIX: isContinous = false; break; case GpsStatus.GPS_EVENT_STOPPED: tearTrack(); updateGpsStatus(GPS_OFF, 0, 0); updateProvider(LocationManager.GPS_PROVIDER, false); break; case GpsStatus.GPS_EVENT_SATELLITE_STATUS: if (locationManager == null) return; GpsStatus gpsStatus = locationManager.getGpsStatus(null); Iterator<GpsSatellite> it = gpsStatus.getSatellites().iterator(); int tSats = 0; int fSats = 0; while (it.hasNext()) { tSats++; GpsSatellite sat = (GpsSatellite) it.next(); if (sat.usedInFix()) fSats++; } if (SystemClock.elapsedRealtime() - lastLocationMillis < 3000) { updateGpsStatus(GPS_OK, fSats, tSats); } else { tearTrack(); updateGpsStatus(GPS_SEARCHING, fSats, tSats); } break; } }