delight-im / Android-SimpleLocation

Utility class for easy access to the device location on Android
Apache License 2.0
200 stars 75 forks source link

Location is not giving updated latitude and longitude #21

Closed sandeeplondhe closed 6 years ago

sandeeplondhe commented 6 years ago

When it changes the position it is not updating the latitude and longitude so giving old values instead of giving new latitude and longitude values.

        location.setListener(new SimpleLocation.Listener() {

            public void onPositionChanged() {
                // new location data has been received and can be accessed

                    latitude_user = location.getLatitude();
                    longitude_user = location.getLongitude();

}
ocram commented 6 years ago
  1. Can you log something in the onPositionChanged callback to see if that method is ever executed at all?
  2. Can you show your call to the SimpleLocation constructor?
  3. Did you follow all steps from the README?