Merge pull request #280 from misaochan/fix-location-0

Fix (0,0) location bug
This commit is contained in:
Josephine Lim 2016-09-17 17:14:31 +12:00 committed by GitHub
commit 93e8b777bb

View file

@ -25,7 +25,8 @@ public class GPSExtractor {
private String filePath;
private double decLatitude, decLongitude;
private double currentLatitude, currentLongitude;
private Double currentLatitude = null;
private Double currentLongitude = null;
private Context context;
public boolean imageCoordsExists;
private MyLocationListener myLocationListener;
@ -113,7 +114,8 @@ public class GPSExtractor {
//Check what user's preference is for automatic location detection
boolean gpsPrefEnabled = gpsPreferenceEnabled();
if (gpsPrefEnabled) {
//Check that currentLatitude and currentLongitude have been explicitly set by MyLocationListener and do not default to (0.0,0.0)
if (gpsPrefEnabled && currentLatitude != null && currentLongitude != null) {
Log.d(TAG, "Current location values: Lat = " + currentLatitude + " Long = " + currentLongitude);
return String.valueOf(currentLatitude) + "|" + String.valueOf(currentLongitude);
} else {