I need to add a method to capture the latitude and longitude that I use to show it, I am only interested in obtaining the two values when a button is pressed to show it and then I am no longer interested in moving. Thanks in advance. This form turned out to me but sometimes it returns to me null I don't know why?
LocationManager locationManager = (LocationManager)getSystemService(this.LOCATION_SERVICE);
Criteria criteria = new Criteria();
Location location = locationManager.getLastKnownLocation (locationManager.getBestProvider(criteria, false));
double latitudActual = location.getLatitude();
double longitudActual = location.getLongitude();