I am working on an app that calculate the distance between 2 points but i don't now how to get the current position.I'm using a google maps activity.
Any help would be greatly appreciated.
The code:
LocationManager service = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
String provider = service.getBestProvider(criteria, false); service.requestLocationUpdates(provider,1000,0,locationListenerGPS); Location location = service.getLastKnownLocation(provider);
LatLng userLocation = new LatLng(location.getLatitude(),location.getLongitude());