I want to know how can I get my last known location (GPS or network provided). I'm asking this because I know how to get my location but it's going to be updated periodically and I just want it once and no any more.
Here's my actual code:
@Override
public void onLocationChanged(Location location) {
Toast.makeText(getContext(),"Cambio posicion "+location.getProvider(),Toast.LENGTH_SHORT).show();
this.marca.title("Mi ubicacion");
this.marca.position(new LatLng(location.getLatitude(),location.getLongitude()));
mMap.addMarker(this.marca);
this.camara = CameraPosition.builder()
.bearing(0)
.zoom(15)
.target(new LatLng(location.getLatitude(),location.getLongitude()))
.tilt(30)
.build();
mMap.animateCamera(CameraUpdateFactory.newCameraPosition(this.camara));
}
I'm using LocationManager. Thanks for your help.