Java Code Examples for com.google.android.gms.location.LocationRequest#setSmallestDisplacement()
The following examples show how to use
com.google.android.gms.location.LocationRequest#setSmallestDisplacement() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GoogleLocationEngineImpl.java From mapbox-events-android with MIT License | 5 votes |
private static LocationRequest toGMSLocationRequest(LocationEngineRequest request) { LocationRequest locationRequest = new LocationRequest(); locationRequest.setInterval(request.getInterval()); locationRequest.setFastestInterval(request.getFastestInterval()); locationRequest.setSmallestDisplacement(request.getDisplacement()); locationRequest.setMaxWaitTime(request.getMaxWaitTime()); locationRequest.setPriority(toGMSLocationPriority(request.getPriority())); return locationRequest; }
Example 2
Source File: FusedLocationModule.java From react-native-fused-location with MIT License | 5 votes |
private LocationRequest buildLR() { LocationRequest request = new LocationRequest(); request.setPriority(mLocationPriority); request.setInterval(mLocationInterval); request.setFastestInterval(mLocationFastestInterval); request.setSmallestDisplacement(mSmallestDisplacement); return request; }
Example 3
Source File: LocationTracker.java From SampleApp with Apache License 2.0 | 5 votes |
/** * Creating location request object */ private void createLocationRequest() { mLocationRequest = new LocationRequest(); mLocationRequest.setInterval(UPDATE_INTERVAL); mLocationRequest.setFastestInterval(FATEST_INTERVAL); mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); mLocationRequest.setSmallestDisplacement(DISPLACEMENT); }
Example 4
Source File: NearbyLocationActivity.java From FaceT with Mozilla Public License 2.0 | 4 votes |
@Override public void onConnected(Bundle connectionHint) { Log.d("MYTAG", "GOOGLE API CONNECTED!"); statusCheck(); if (ContextCompat.checkSelfPermission(NearbyLocationActivity.this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { mLocationRequest = new LocationRequest(); mLocationRequest.setInterval(1); mLocationRequest.setFastestInterval(1); mLocationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY); mLocationRequest.setSmallestDisplacement(0); LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this); mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient); Log.d("onConnected", "here!!!!!!!!!!!!"); // if (mLastLocation != null) { // Log.d("onConnected", "not null!!!!!!!!!!!!"); //// LatLng newLocation = new LatLng(mLastLocation.getLongitude(),mLastLocation.getLatitude()); //// mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(newLocation, 9), 3000, null); // initialize=1; // if (LocationServices.FusedLocationApi.getLocationAvailability(mGoogleApiClient).isLocationAvailable()) { //// currentLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient); //// if (currentLocation != null) { // LatLng myCurrentLocation = new LatLng(mLastLocation.getLatitude(), mLastLocation.getLongitude()); // mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(myCurrentLocation, 14), 3000, null); // bottomPanel.setVisibility(View.GONE); //// } // } // // List<Shop> shopWithinRange = new ArrayList<>(); // for (int i = 0; i < shopList.size(); i++) { // LatLng shopLocation = new LatLng(shopList.get(i).getLatitude(), shopList.get(i).getLongitude()); // Marker shopLocationMarker = mMap.addMarker(new MarkerOptions().position(shopLocation) // .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE))); // shopLocationMarker.setVisible(false); // Location target = new Location("target"); // target.setLatitude(shopList.get(i).getLatitude()); // target.setLongitude(shopList.get(i).getLongitude()); // Log.d("before_compare_location", "" + mLastLocation.distanceTo(target)); // if (mLastLocation.distanceTo(target) < 3000) { // shopLocationMarker.setVisible(true); // shopWithinRange.add(shopList.get(i)); // } // } //// LatLng myCurrentLatLng = new LatLng(shopWithinRange.get(2).getLatitude(), shopWithinRange.get(2).getLongitude()); //// mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(myCurrentLatLng, 13), 4000, null); // } } }