List of usage examples for android.location LocationManager GPS_PROVIDER
String GPS_PROVIDER
To view the source code for android.location LocationManager GPS_PROVIDER.
Click Source Link
From source file:com.geoffreybuttercrumbs.arewethereyet.ZonePicker.java
@Override public void onProviderDisabled(String provider) { if (provider.equalsIgnoreCase(LocationManager.GPS_PROVIDER)) Toast.makeText(getApplicationContext(), "GPS is turned off. Are We There Yet only works when GPS is turned on.", Toast.LENGTH_LONG) .show();/* ww w . j a va 2 s . c o m*/ }
From source file:com.m2dl.mini_projet.mini_projet_android.MainActivity.java
@Override protected void onResume() { super.onResume(); if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 3000, 5, this); }/*from www. ja v a2 s . c o m*/ }
From source file:de.grundid.plusrad.recording.RecordingService.java
@Override public void onProviderDisabled(String provider) { Log.i(TAG, "provider disabled: " + provider); if (LocationManager.GPS_PROVIDER.equals(provider)) { pauseRecording();//from w w w . j a va 2 s . c o m } }
From source file:com.example.b1013029.myapplication.MapsActivity.java
private void setMyLocation() { LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); Location lastLocate = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (lastLocate != null) { LatLng position = new LatLng(lastLocate.getLatitude(), lastLocate.getLongitude()); this.gMap.animateCamera(CameraUpdateFactory.newLatLngZoom(position, gMap.getCameraPosition().zoom)); } else {// w ww.j a v a 2 s . c o m Toast.makeText(this, "????????", Toast.LENGTH_SHORT).show(); } }
From source file:com.keithcassidy.finishline.FinishLineService.java
private void registerLocationListener() { unregisterLocationListener();//from www. j av a 2 s .c om try { locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, locationPollingInterval, minDistance, locationListener); } catch (RuntimeException e) { Toast.makeText(getBaseContext(), "Error registering gps", Toast.LENGTH_SHORT).show(); Log.e(TAG, "Could not request Location Updates.", e); } }
From source file:eu.geopaparazzi.library.gps.GpsService.java
/** * Starts listening to the gps provider. *//*from w w w. j a va2 s . c o m*/ private void registerForLocationUpdates() { try { if (isMockMode) { log("Gps started using Mock locations"); TestMock.startMocking(locationManager, this); isListeningForUpdates = true; } else { float minDistance = 0.2f; long waitForSecs = WAITSECONDS; if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException(); } if (useNetworkPositions) { locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, waitForSecs * 1000l, minDistance, this); } else { locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, waitForSecs * 1000l, minDistance, this); } isListeningForUpdates = true; log("registered for updates."); } broadcast("triggered by registerForLocationUpdates"); } catch (Exception e) { GPLog.error(this, null, e); isListeningForUpdates = false; } }
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:// w ww .jav a2 s . c o m disableConnectionButton(R.id.GAME_RB_GPS); break; } } Log.d(GameActivity.class.getName(), "status changed to " + provider + " [" + status + "]"); }
From source file:com.forrestguice.suntimeswidget.getfix.GetFixHelper.java
public static boolean isGPSProviderEnabled(Context context) { LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); }
From source file:de.grundid.plusrad.recording.RecordingService.java
@Override public void onProviderEnabled(String provider) { Log.i(TAG, "provider enabled: " + provider); if (LocationManager.GPS_PROVIDER.equals(provider) && state == STATE_PAUSED) { resumeRecording();/*from www.ja va 2 s. c om*/ } }
From source file:com.cianmcgovern.android.ShopAndShare.Share.java
/** * //ww w .j a v a2 s. com * Gets the location using the LocationListener and sets the class wide * location variable with the latitude and longitude Only gets the location * once and removes the listener after that result is obtained * */ public void getLocation() { LocationListener locationListener = new LocationListener() { @Override public void onLocationChanged(Location loc) { Log.v(Constants.LOG_TAG, "Got longitude: " + loc.getLongitude()); Log.v(Constants.LOG_TAG, "Got latitude: " + loc.getLatitude()); mLocation.setLongitude(loc.getLongitude()); mLocation.setLatitude(loc.getLatitude()); getAddress(); mLocationManager.removeUpdates(this); mSearch.setEnabled(true); } @Override public void onProviderDisabled(String provider) { } @Override public void onProviderEnabled(String provider) { } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } }; mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener); }