Пример #1
0
  @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps_daus);
    MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.maps);

    mapFragment.getMapAsync(this);

    try {
      initializeMaps();
      gMaps.addMarker(
          new MarkerOptions()
              .icon(BitmapDescriptorFactory.fromResource(R.drawable.wisataa))
              .position(new LatLng(5.559382, 95.321629))
              .visible(true)
              .title("Nasi Goreng Daus"));
      gMaps.setMyLocationEnabled(true);
      CameraPosition cameraPosition =
          new CameraPosition.Builder().target(new LatLng(5.484702, 95.227189)).zoom(10).build();
      gMaps.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
      gMaps.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition), 2000, null);
    } catch (Exception e) {
    }
  }
  @UiThread
  void updateUiAdapter(Address address) {
    if (map == null) {
      return;
    }
    try {
      ignoreUpdate = true;
      CameraPosition position =
          new CameraPosition.Builder()
              .target(new LatLng(address.getLatitude(), address.getLongitude()))
              .zoom(currentZoom)
              .build();
      CameraUpdate update = CameraUpdateFactory.newCameraPosition(position);
      map.animateCamera(update);

      autocompleteEndereco.setAdapter(null);
      autocompleteEndereco.setText(street);
      autocompleteEndereco.setAdapter(
          new PlacesAutoCompleteAdapter(
              getActivity(), R.layout.autocomplete_list_item, ExploreFragment.class));
      tvNumero.setText(number);
    } catch (Exception e) {
      Log.e("ZUP", e.getMessage(), e);
      Crashlytics.logException(e);
    }
  }
  private void setUpMap() {
    verifyLocationPermission();

    mMap.setOnMapClickListener(this);
    mMap.setOnInfoWindowClickListener(this);

    UiSettings settings = mMap.getUiSettings();
    settings.setAllGesturesEnabled(true);
    settings.setMapToolbarEnabled(false);

    // Use stops location if present, otherwise set a geo point in
    // central Stockholm.
    LatLng latLng;
    int zoom;
    if (mStop.getLocation() != null) {
      latLng = new LatLng(mStop.getLocation().getLatitude(), mStop.getLocation().getLongitude());
      zoom = 16;
    } else {
      latLng = new LatLng(59.325309, 18.069763);
      zoom = 12;
    }

    mMarker =
        mMap.addMarker(
            new MarkerOptions()
                .position(latLng)
                .title(getString(R.string.tap_to_select_this_point))
                .visible(true)
                .draggable(true)
                .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)));
    mMarker.showInfoWindow();

    mMap.moveCamera(
        CameraUpdateFactory.newCameraPosition(CameraPosition.fromLatLngZoom(latLng, zoom)));
  }
 @UiThread
 void mapInit() {
   map.setMyLocationEnabled(true);
   map.getUiSettings().setZoomControlsEnabled(false);
   map.getUiSettings().setMyLocationButtonEnabled(true);
   map.setOnCameraChangeListener(
       cameraPosition -> {
         Log.i("Alterou posição", "Alteração = " + count++);
         if (latitude != cameraPosition.target.latitude
             && longitude != cameraPosition.target.longitude) {
           latitude = cameraPosition.target.latitude;
           longitude = cameraPosition.target.longitude;
           currentZoom = cameraPosition.zoom;
           cameraChangeTask();
         }
       });
   map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
   CameraPosition p =
       new CameraPosition.Builder()
           .target(new LatLng(Constantes.INITIAL_LATITUDE, Constantes.INITIAL_LONGITUDE))
           .zoom(12)
           .build();
   CameraUpdate update = CameraUpdateFactory.newCameraPosition(p);
   map.moveCamera(update);
 }
Пример #5
0
  private void centerOnRoute() {
    double lat = 0.0;
    double lng = 0.0;
    double maxLat = 0.0;
    double maxLng = 0.0;
    float fZoom = 0;
    int size = 0;

    if (route != null) {
      size = route.getMarkerMap().size();
      for (MarkerModel value : route.getMarkerMap().values()) {
        lat += value.getLat();
        lng += value.getLng();
        if (Math.abs(value.getLat()) > maxLat) {
          maxLat = value.getLat();
        }
        if (Math.abs(value.getLng()) > maxLng) {
          maxLng = value.getLng();
        }
      }
    }

    if (size > 0) {

      lat = lat / route.getMarkerMap().size();
      lng = lng / route.getMarkerMap().size();
      fZoom = calculateZoom((maxLat - lat), (maxLng - lng));
      CameraPosition cameraPosition =
          new CameraPosition.Builder().target(new LatLng(lat, lng)).zoom(fZoom).build();
      googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
    }
  }
Пример #6
0
  // 移動地圖到參數指定的位置
  private void moveMap(LatLng place) {
    // 建立地圖攝影機的位置物件
    CameraPosition cameraPosition = new CameraPosition.Builder().target(place).zoom(17).build();

    // 使用動畫的效果移動地圖
    mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
  }
  public void addHeatMap(List<GridPoint> gridPointList) {
    clearMap();
    List<LatLng> list = new ArrayList<LatLng>();
    LatLngBounds.Builder builder = new LatLngBounds.Builder();
    LatLng latLng = null;

    for (GridPoint gridPoint : gridPointList) {
      latLng =
          new LatLng(
              gridPoint.getLocation().getLatitude().doubleValue(),
              gridPoint.getLocation().getLongitude().doubleValue());
      list.add(latLng);
      builder.include(latLng);
    }

    if (list.size() < 1) {
      return;
    }

    mProvider = new HeatmapTileProvider.Builder().data(list).build();
    mOverlay = googleMap.addTileOverlay(new TileOverlayOptions().tileProvider(mProvider));

    if (gridPointList.size() > 1) {
      LatLngBounds bounds = builder.build();
      CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, 0);
      googleMap.animateCamera(cu);
    } else if (gridPointList.size() > 0) {
      CameraPosition cameraPosition =
          new CameraPosition.Builder().target(latLng).zoom(zoomLevel).bearing(0).tilt(45).build();
      googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
    }
    markersDisplayed = false;
    heatmapDisplayed = true;
    clusterDisplayed = false;
  }
  @Override
  public void onConnected(Bundle bundle) {
    Log.i(TAG, "Location services connected.");

    Location lastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);

    if (lastLocation == null) {
      Toast.makeText(
              FullScreenMapActivity.this, "There is currently no connectivity", Toast.LENGTH_LONG)
          .show();
    } else {

      ParseGeoPoint point =
          new ParseGeoPoint(lastLocation.getLatitude(), lastLocation.getLongitude());
      ParseUser currentUser = ParseUser.getCurrentUser();
      currentUser.put("location", point);
      currentUser.saveInBackground();

      mGoogleMap.animateCamera(CameraUpdateFactory.zoomIn());

      CameraPosition cameraPosition =
          new CameraPosition.Builder()
              .target(new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude()))
              .zoom(12)
              .bearing(90)
              .tilt(30)
              .build();

      mGoogleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
    }
  }
Пример #9
0
  @Override
  public void onMapReady(GoogleMap googleMap) {
    Log.d(TAG, "Map Received");
    this.map = googleMap;
    map.setMapType(GoogleMap.MAP_TYPE_NORMAL);

    Location location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
    if (location != null) {
      map.animateCamera(
          CameraUpdateFactory.newLatLngZoom(
              new LatLng(location.getLatitude(), location.getLongitude()), 17));

      CameraPosition cameraPosition =
          new CameraPosition.Builder()
              .target(
                  new LatLng(
                      location.getLatitude(),
                      location.getLongitude())) // Sets the center of the map to location user
              .zoom(17) // Sets the zoom
              .bearing(90) // Sets the orientation of the camera to east
              .tilt(40) // Sets the tilt of the camera to 30 degrees
              .build(); // Creates a CameraPosition from the builder
      map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
    }
  }
Пример #10
0
  /**
   * @param lat - latitude of the location to move the camera to
   * @param lng - longitude of the location to move the camera to Prepares a CameraUpdate object to
   *     be used with callbacks
   */
  private void gotoMyLocation(double lat, double lng, float bear) {

    changeCamera(
        CameraUpdateFactory.newCameraPosition(
            new CameraPosition.Builder()
                .target(new LatLng(lat, lng))
                .zoom(18f)
                .tilt(20)
                .bearing(bear)
                .build()),
        new GoogleMap.CancelableCallback() {
          @Override
          public void onFinish() {
            // Your code here to do something after the Map is rendered
          }

          @Override
          public void onCancel() {
            // Your code here to do something after the Map rendering is cancelled
          }
        });

    //        googleMap.addPolyline(new PolylineOptions().geodesic(true)
    //                .add(new LatLng(lat, lng)))  ;
  }
    @Override
    protected void onPostExecute(Void result) {
      Polyline route =
          oMapView.addPolyline(new PolylineOptions().width(5).color(Color.BLUE).geodesic(true));
      route.setPoints(aLatLng);

      oMapView.addMarker(
          new MarkerOptions()
              .position(ExerciseManipulate.getWatchPoint().get(0).getLatLong())
              .title("Start"));
      oMapView.addMarker(
          new MarkerOptions()
              .position(
                  ExerciseManipulate.getWatchPoint()
                      .get(ExerciseManipulate.getWatchPoint().size() - 1)
                      .getLatLong())
              .title("End " + ExerciseManipulate.getsTotalDistance()));

      CameraPosition newCamPos =
          new CameraPosition(
              ExerciseManipulate.getWatchPoint()
                  .get(ExerciseManipulate.getWatchPoint().size() / 2)
                  .getLatLong(),
              12.5f,
              oMapView.getCameraPosition().tilt, // use old tilt
              oMapView.getCameraPosition().bearing); // use old bearing
      oMapView.animateCamera(CameraUpdateFactory.newCameraPosition(newCamPos), 4000, null);

      // oMapView.addPolyline((new PolylineOptions()).addAll(aLatLng));
      // oMapView.moveCamera(CameraUpdateFactory.newLatLng(ExerciseManipulate.getWatchPoint().get(0).getLatLong()));
    }
Пример #12
0
  public GPSTracker(Context context, GoogleMap googleMap, FloatingActionButton focusSelfButton) {
    this.context = context;
    this.mMap = googleMap;
    this.focusSelfButton = focusSelfButton;

    getInitLocation();

    if (latLng != null) {
      mMap.animateCamera(
          CameraUpdateFactory.newCameraPosition(new CameraPosition(latLng, 13, 0, 0)));

      this.marker =
          mMap.addMarker(
              new MarkerOptions()
                  .position(latLng)
                  .title("Current location")
                  .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)));

      focusSelfButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              mMap.animateCamera(
                  CameraUpdateFactory.newCameraPosition(new CameraPosition(latLng, 13, 0, 0)));
            }
          });

      String[] params = {
        Player.currentPlayer.getGoogleID(), Double.toString(latitude), Double.toString(longitude)
      };
      new EditPlayer().execute(params);
    }
  }
Пример #13
0
  private void drawCurrentLocation(LatLng current_location) {

    if (cLMarker != null) {
      cLMarker.remove();
    }

    cLMarker =
        googleMap.addMarker(
            markerOptions
                .position(current_location)
                .title("Current Position")
                .snippet("")
                .flat(true)
                .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE)));

    if (firstTimeCameraMove) {
      googleMap.animateCamera(CameraUpdateFactory.newLatLng(current_location));

      CameraPosition cameraPosition =
          new CameraPosition.Builder()
              .target(current_location) // Sets the center of the map to location user
              .zoom(17) // Sets the zoom
              .build(); // Creates a CameraPosition from the builder
      googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
      firstTimeCameraMove = false;
    }
  }
Пример #14
0
 private void setUpMap() {
   mMap.addMarker(
       new MarkerOptions().position(new LatLng(37.232181, -76.64655)).title("Curse of DarKastle"));
   mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
   mMap.setMyLocationEnabled(false);
   mMap.getUiSettings().setZoomControlsEnabled(false);
   mMap.moveCamera(CameraUpdateFactory.newCameraPosition(HOME));
 }
Пример #15
0
  /**
   * Move the camera to the location specified
   *
   * @param newLocation
   */
  private void moveCamera(LatLng newLocation, float zoomLevel) {
    CameraPosition camPos =
        new CameraPosition.Builder().target(newLocation).zoom(zoomLevel).build();

    CameraUpdate cameraUpdate = CameraUpdateFactory.newCameraPosition(camPos);

    mMap.animateCamera(cameraUpdate);
  }
Пример #16
0
  private void initilizeMap() {
    if (googleMap == null) {
      googleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
      googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
      googleMap.addMarker(new MarkerOptions().position(iiitm).title("ABV-IIITM"));
      googleMap.addMarker(new MarkerOptions().position(OAT).title("OPEN-AIR-THEATER"));
      googleMap.addMarker(new MarkerOptions().position(BH1).title("BOYS HOSTEL-1"));
      googleMap.addMarker(new MarkerOptions().position(BH2).title("BOYS HOSTEL-2"));
      googleMap.addMarker(new MarkerOptions().position(BH3).title("BOYS HOSTEL-3"));
      googleMap.addMarker(new MarkerOptions().position(ACEDMIC).title("ACEDMIC BLOCK"));
      googleMap.addMarker(new MarkerOptions().position(GH).title("GIRLS HOSTEL"));
      googleMap.addMarker(new MarkerOptions().position(MDP).title("MANAGEMENT BLOCK"));
      googleMap.addMarker(new MarkerOptions().position(BC).title("BUTTERFLY CONSERVATRY"));
      googleMap.addMarker(new MarkerOptions().position(CANTEEN).title("CANTEEN"));
      googleMap.addMarker(new MarkerOptions().position(VH).title("GUEST HOUSE"));
      googleMap.addMarker(new MarkerOptions().position(MG).title("MAIN GATE"));
      googleMap.setMyLocationEnabled(true);
      googleMap.getUiSettings().setMyLocationButtonEnabled(true);
      //  googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
      googleMap.getUiSettings().setZoomControlsEnabled(true);
      CameraPosition cameraPosition = new CameraPosition.Builder().target(iiitm).zoom(15).build();

      googleMap.setOnMapClickListener(
          new GoogleMap.OnMapClickListener() {

            @Override
            public void onMapClick(LatLng latLng) {
              MarkerOptions markerOptions = new MarkerOptions();
              markerOptions.position(latLng);
              // the title for the marker.
              String sss = "no"; // This will be displayed on taping the marker
              try {
                sss = aadd(latLng);
                //      	e.setText("fdh");
              } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }
              //  markerOptions.title(latLng.latitude + " : " + latLng.longitude);
              markerOptions.title(sss);
              // Clears the previously touched position
              googleMap.clear();

              // Animating to the touched position
              googleMap.animateCamera(CameraUpdateFactory.newLatLng(latLng));

              // Placing a marker on the touched position
              googleMap.addMarker(markerOptions);
            }
          });

      googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
      // check if map is created successfully or not
      if (googleMap == null) {
        Toast.makeText(getActivity(), "Sorry! unable to create maps", Toast.LENGTH_SHORT).show();
      }
    }
  }
 public boolean animateToLocation(LatLng location) {
   if (mGoogleMap != null) {
     CameraPosition newCameraPosition =
         new CameraPosition.Builder().target(location).zoom(DEFAULT_MAP_ZOOM_LEVEL).build();
     mGoogleMap.animateCamera(CameraUpdateFactory.newCameraPosition(newCameraPosition));
     return true;
   }
   return false;
 }
Пример #18
0
  /** adding lines */
  private void addLines() {

    googleMap.addPolyline(
        (new PolylineOptions()).addAll(coordinates).width(5).color(Color.BLUE).geodesic(true));
    CameraPosition mCameraPosition =
        CameraPosition.builder().target(COPPER).zoom(14).bearing(90).build();
    // Animate the change in camera view over 2 seconds
    googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(mCameraPosition), 2000, null);
  }
 public static void animateCameraLatLng(GoogleMap mMap, LatLng location, Resources resources) {
   CameraPosition cameraPosition =
       new CameraPosition.Builder()
           .target(location)
           .zoom(resources.getInteger(R.integer.zoom_level))
           .tilt(0)
           .bearing(0)
           .build();
   mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
 }
 public Boolean centreMapAt(double lat, double lng) {
   if (googleMap != null) {
     LatLng location = new LatLng(lat, lng);
     CameraPosition cameraPosition =
         new CameraPosition.Builder().target(location).zoom(zoomLevel).bearing(0).tilt(45).build();
     googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
     return true;
   }
   return false;
 }
Пример #21
0
 private void setUpMap() {
   mMap.addMarker(
       new MarkerOptions()
           .position(LOC_BITTEN)
           .title("Miracles")
           .snippet("Celebrate the spirit of Christmas through powerful movement and dance."));
   mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
   mMap.setMyLocationEnabled(false);
   mMap.getUiSettings().setZoomControlsEnabled(false);
   mMap.moveCamera(CameraUpdateFactory.newCameraPosition(HOME));
 }
Пример #22
0
  /**
   * This is where we can add markers or lines, add listeners or move the camera. In this case, we
   * just add a marker near Africa.
   */
  @Override
  public void onMapReady(GoogleMap map) {

    mMap = map;

    new GetInterestsAsyncTask(this).execute();

    // map.addMarker(new MarkerOptions().position(BMIG.target).title("Marker"));

    map.moveCamera(CameraUpdateFactory.newCameraPosition(BMIG));
  }
Пример #23
0
 /*
     @Override
     public void onDisconnected() {
         // nop
     }
 */
 @Override
 public void onLocationChanged(Location location) {
   // 現在地に移動
   CameraPosition cameraPos =
       new CameraPosition.Builder()
           .target(new LatLng(location.getLatitude(), location.getLongitude()))
           .zoom(16.0f)
           .bearing(0)
           .build();
   mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPos));
   LocationServices.FusedLocationApi.removeLocationUpdates(mLocationClient, this);
 }
 @Click
 void locationButton() {
   if (map == null) {
     return;
   }
   CameraPosition position =
       new CameraPosition.Builder()
           .target(new LatLng(userLatitude, userLongitude))
           .zoom(16f)
           .build();
   CameraUpdate update = CameraUpdateFactory.newCameraPosition(position);
   map.animateCamera(update);
 }
 @UiThread
 void updateCamera(LatLng latLong) {
   if (map == null) {
     return;
   }
   try {
     CameraPosition p = new CameraPosition.Builder().target(latLong).zoom(16f).build();
     CameraUpdate update = CameraUpdateFactory.newCameraPosition(p);
     map.animateCamera(update);
   } catch (Exception e) {
     Log.e("ZUP", e.getMessage(), e);
     Crashlytics.logException(e);
   }
 }
 /**
  * Method to to move map to new address.
  *
  * @param address
  */
 private void moveMap(Address address) {
   if (address != null) {
     CameraPosition newPlace =
         new CameraPosition.Builder()
             .target(new LatLng(address.getLatitude(), address.getLongitude()))
             .zoom(15.5f)
             .bearing(8)
             .tilt(0)
             .build();
     map.animateCamera(CameraUpdateFactory.newCameraPosition(newPlace));
   } else {
     Toast.makeText(context, "Cannot find location.", Toast.LENGTH_LONG).show();
   }
 }
Пример #27
0
 public void zoomCamera() {
   try {
     CameraPosition cameraPosition =
         new CameraPosition.Builder()
             .target(getLatLng(PERSONS.get(0)))
             .zoom(12)
             .bearing(45)
             .tilt(20)
             .build();
     CameraUpdate cameraUpdate = CameraUpdateFactory.newCameraPosition(cameraPosition);
     map.animateCamera(cameraUpdate);
   } catch (IndexOutOfBoundsException e) {
   }
 }
  private void zoomToLocation(double x, double y) {

    mapView.setVisibility(View.VISIBLE);
    mapContainer.setVisibility(View.VISIBLE);
    progress.setVisibility(View.GONE);
    map.clear();
    map.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(y, x), 13));
    CameraPosition cameraPosition =
        new CameraPosition.Builder().target(new LatLng(y, x)).zoom(17).build();
    map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
    map.addMarker(new MarkerOptions().position(new LatLng(y, x)));

    populateAddressViews(new LatLng(y, x));
  }
Пример #29
0
  @Override
  public void onMapReady(GoogleMap map) {
    LatLng dosDeMayo = new LatLng(-12.046374, -77.0427934);
    LatLng bolognesi = new LatLng(-12.06030544, -77.0415616);
    LatLng posRandom1 = new LatLng(-12.02244752, -77.05248356);
    LatLng posRandom2 = new LatLng(-12.01816614, -77.05336332);
    LatLng posReu = new LatLng(-12.02478756, -77.05208659);

    LatLng myPosLL = new LatLng(-12.01712464, -77.05044508);
    // Markers
    // map.addMarker(new MarkerOptions().position(dosDeMayo).title("Pepito"));
    map.addMarker(
        new MarkerOptions()
            .icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_user_16))
            .position(dosDeMayo)
            .title("Fulano"));
    map.addMarker(
        new MarkerOptions()
            .icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_user_16))
            .position(bolognesi)
            .title("Mengano"));
    map.addMarker(
        new MarkerOptions()
            .icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_user_16))
            .position(posRandom2)
            .title("Zutano"));
    map.addMarker(
        new MarkerOptions()
            .icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_user_16))
            .position(posRandom1)
            .title("Perengano"));
    map.addMarker(
        new MarkerOptions()
            .icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_grupo_16))
            .position(posReu)
            .title("Evento 1")
            .snippet("31 de octubre"));
    // Positions
    // map.moveCamera(CameraUpdateFactory.newLatLng(dosDeMayo));
    CameraPosition myPos = new CameraPosition.Builder().target(myPosLL).zoom(14).build();
    mMap.animateCamera(CameraUpdateFactory.newCameraPosition(myPos));

    // Busca mi posición
    LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    Criteria criteria = new Criteria();
    String provider = locationManager.getBestProvider(criteria, true);
    // checkPermission();
    // Fin mi posicion
  }
  public void updateMarkerLocation(double lat, double lng) {
    LatLng location = new LatLng(lat, lng);

    if (marker == null) {
      markerOptions = new MarkerOptions();
      markerOptions.visible(true);
      markerOptions.position(location);
      markerOptions.draggable(draggable);
      marker = googleMap.addMarker(markerOptions);
    }

    CameraPosition cameraPosition =
        new CameraPosition.Builder().target(location).zoom(zoomLevel).bearing(0).tilt(45).build();
    googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
    marker.setPosition(location);
  }