How do I determine my current location?
How can I find out my coordinates without maps? This is how I get my coordinates with the map.
myMap.setMyLocationEnabled(true);
LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
Criteria criteria = new Criteria();
String provider = locationManager.getBestProvider(criteria, true);
// Getting Current Location
Location location = locationManager.getLastKnownLocation(provider);
if (location != null) {
double latitude = location.getLatitude();
double longitude = location.getLongitude();
myPosition = new LatLng(latitude, longitude);}
How can I get my location without creating a myMap object (GoogleMap)?
1
Author: Nicolas Chabanovsky, 2014-05-07
1 answers
I think you should have googled a little. If it didn't work out, here's a link to my torment: LocationListener: the problem is in determining the coordinates of the user.
1
Author: andreich, 2017-04-12 07:33:09