mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
If else block for gps prefs
This commit is contained in:
parent
5492aa7551
commit
11e291cb41
1 changed files with 19 additions and 14 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue