title: get current location without using map in android
body: <p>how to get the current user location without using a map in the activity? i just want to store the coordinates of the location ?
  i used this code but it doesn't works !</p>
  
  <pre><code>LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
  
  Criteria criteria = new Criteria();
  
  String provider = locationManager.getBestProvider(criteria, true);
  
  Location location = locationManager.getLastKnownLocation(provider);
  latitude = location.getLatitude();
  longitude = location.getLongitude();
  </code></pre>