If else block for gps prefs

This commit is contained in:
misaochan 2016-02-05 18:31:46 +13:00
parent 5492aa7551
commit 11e291cb41

View file

@ -65,6 +65,8 @@ public class GPSExtractor {
//Check what user's preference is for automatic location detection
boolean gpsPrefEnabled = gpsPreferenceEnabled();
if (gpsPrefEnabled) {
//If pref enabled, set up LocationListener to get current location
LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
String provider = locationManager.getBestProvider(criteria, true);
@ -75,14 +77,17 @@ public class GPSExtractor {
if (location != null) {
myLocationListener.onLocationChanged(location);
}
else {
} else {
//calling method is equipped to deal with null return value
return null;
}
Log.d(TAG, "Current location values: Lat = " + currentLatitude + " Long = " + currentLongitude);
String currentCoords = String.valueOf(currentLatitude) + "|" + String.valueOf(currentLongitude);
return currentCoords;
} else {
//Otherwise treat as if no coords found
return null;
}
} else {
imageCoordsExists = true;