List of usage examples for android.location LocationProvider AVAILABLE
int AVAILABLE
To view the source code for android.location LocationProvider AVAILABLE.
Click Source Link
From source file:ch.luethi.skylinestracker.PositionService.java
@Override public void onStatusChanged(String s, int i, Bundle bundle) { if (i != LocationProvider.AVAILABLE) { sendPositionWaitStatus();/*from w ww .j a v a2 s. c om*/ } }
From source file:com.nextgis.firereporter.SendReportActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.report);//from w w w . j ava 2 s .c om //add fragment FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); frCompass = (CompassFragment) getSupportFragmentManager().findFragmentByTag("COMPASS"); if (frCompass == null) { frCompass = new CompassFragment(); fragmentTransaction.add(R.id.compass_fragment_container, frCompass, "COMPASS").commit(); } getSupportFragmentManager().executePendingTransactions(); getSupportActionBar().setHomeButtonEnabled(true); edLatitude = (EditText) findViewById(R.id.edLatitude); edLongitude = (EditText) findViewById(R.id.edLongitude); edAzimuth = (EditText) findViewById(R.id.edAzimuth); edDistance = (EditText) findViewById(R.id.edDistance); edComment = (EditText) findViewById(R.id.edComment); edDistance.setText("100"); mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); if (mLocationManager != null) { for (String aProvider : mLocationManager.getProviders(false)) { if (aProvider.equals(LocationManager.GPS_PROVIDER)) { gpsAvailable = true; } } if (gpsAvailable) { Location location = mLocationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (location != null) { float lat = (float) (location.getLatitude()); float lon = (float) (location.getLongitude()); edLatitude.setText(Float.toString(lat)); edLongitude.setText(Float.toString(lon)); } else { edLatitude.setText(getString(R.string.noLocation)); edLongitude.setText(getString(R.string.noLocation)); } mLocationListener = new LocationListener() { public void onStatusChanged(String provider, int status, Bundle extras) { switch (status) { case LocationProvider.OUT_OF_SERVICE: break; case LocationProvider.TEMPORARILY_UNAVAILABLE: break; case LocationProvider.AVAILABLE: break; } } public void onProviderEnabled(String provider) { } public void onProviderDisabled(String provider) { } public void onLocationChanged(Location location) { float lat = (float) (location.getLatitude()); float lon = (float) (location.getLongitude()); edLatitude.setText(Float.toString(lat)); edLongitude.setText(Float.toString(lon)); // FIXME: also need to calculate declination? } }; // location listener } else { edLatitude.setText(getString(R.string.noGPS)); edLongitude.setText(getString(R.string.noGPS)); edLatitude.setEnabled(false); edLongitude.setEnabled(false); } } mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); boolean accelerometerAvailable = false; boolean magnetometerAvailable = false; for (Sensor aSensor : mSensorManager.getSensorList(Sensor.TYPE_ALL)) { if (aSensor.getType() == Sensor.TYPE_ACCELEROMETER) { accelerometerAvailable = true; } else if (aSensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) { magnetometerAvailable = true; } } compassAvailable = accelerometerAvailable && magnetometerAvailable; if (compassAvailable) { //frCompass = (CompassFragment) getSupportFragmentManager().findFragmentByTag("COMPASS"); if (frCompass != null) { frCompass.SetAzimuthCtrl(edAzimuth); } } else { edAzimuth.setText(getString(R.string.noCompass)); edAzimuth.setEnabled(false); } }
From source file:org.destil.gpsaveraging.MainActivity.java
@Override public void onStatusChanged(String provider, int status, Bundle extras) { if (status == LocationProvider.AVAILABLE) { DisplayCoordsNoAveraging();/* w ww.j ava 2 s . c om*/ } else { showError(R.string.gps_not_available); } }
From source file:org.mozilla.mozstumbler.service.stumblerthread.scanners.GPSScanner.java
@Override public void onStatusChanged(String provider, int status, Bundle extras) { if ((status != LocationProvider.AVAILABLE) && (LocationManager.GPS_PROVIDER.equals(provider))) { reportLocationLost();//from w w w .j av a 2s . c om } }
From source file:prgc.snct.sos.Activities.MapActivity2.java
@Override public void onStatusChanged(String provider, int status, Bundle extras) { switch (status) { case LocationProvider.AVAILABLE: Log.v("Status", "AVAILABLE"); break;//w ww. j a v a2 s . c o m case LocationProvider.OUT_OF_SERVICE: Log.v("Status", "OUT_OF_SERVICE"); break; case LocationProvider.TEMPORARILY_UNAVAILABLE: Log.v("Status", "TEMPORARILY_UNAVAILABLE"); break; } }
From source file:kn.uni.gis.foxhunt.GameActivity.java
@Override public void onStatusChanged(String provider, int status, Bundle extras) { if (LocationManager.GPS_PROVIDER.equals(provider)) { switch (status) { case LocationProvider.AVAILABLE: enableConnectionButton(R.id.GAME_RB_GPS); break; default:/*from w w w. jav a 2s. c o m*/ disableConnectionButton(R.id.GAME_RB_GPS); break; } } Log.d(GameActivity.class.getName(), "status changed to " + provider + " [" + status + "]"); }
From source file:tcc.iesgo.activity.ClientMapActivity.java
@Override public void onStatusChanged(String provider, int status, Bundle extras) { switch (status) { case LocationProvider.OUT_OF_SERVICE: //Log.v(tag, "Status alterado: Fora de servio"); break;/*from w w w. j a v a2s .c o m*/ case LocationProvider.TEMPORARILY_UNAVAILABLE: //Log.v(tag, "Status alterado: Temporariamente indisponvel"); break; case LocationProvider.AVAILABLE: //Log.v(tag, "Status alterado: Disponvel"); break; } }
From source file:com.jesjimher.bicipalma.MesProperesActivity.java
public void onStatusChanged(String provider, int status, Bundle extras) { Toast.makeText(getApplicationContext(), "Cambio estado GPS", Toast.LENGTH_SHORT).show(); if (provider.equals(LocationManager.GPS_PROVIDER)) { if (status != LocationProvider.AVAILABLE) activarUbicacion();/* w w w . j a va2 s .c om*/ } }
From source file:io.kristal.locationplugin.LocationPlugin.java
@Override public void onStatusChanged(String provider, int status, Bundle bundle) { switch (status) { case LocationProvider.AVAILABLE: onProviderEnabled(provider);/*from ww w . j a va 2 s . com*/ break; case LocationProvider.OUT_OF_SERVICE: onProviderDisabled(provider); break; // TODO: what to do in this case? //case LocationProvider.TEMPORARILY_UNAVAILABLE: } }
From source file:gov.nasa.arc.geocam.geocam.GeoCamMobile.java
private void updateLocation(Location location) { double lat, lon; int status;/*from w w w .j a va 2 s.c o m*/ if (location == null) { lat = 0.0; lon = 0.0; status = LocationProvider.TEMPORARILY_UNAVAILABLE; } else { mLocation = location; mLocationProvider = mLocation.getProvider(); status = LocationProvider.AVAILABLE; lat = mLocation.getLatitude(); lon = mLocation.getLongitude(); } NumberFormat nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits(6); TextView latText = (TextView) findViewById(R.id.main_latitude_textview); TextView lonText = (TextView) findViewById(R.id.main_longitude_textview); latText.setText(nf.format(lat) + DEGREE_SYMBOL); lonText.setText(nf.format(lon) + DEGREE_SYMBOL); ((TextView) findViewById(R.id.main_location_provider_textview)).setText(mLocationProvider); TextView locationStatusText = ((TextView) findViewById(R.id.main_location_status_textview)); switch (status) { case LocationProvider.AVAILABLE: locationStatusText.setText("available"); break; case LocationProvider.TEMPORARILY_UNAVAILABLE: locationStatusText.setText("unavailable"); break; case LocationProvider.OUT_OF_SERVICE: locationStatusText.setText("no service"); break; default: locationStatusText.setText("unknown"); break; } }