mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Moved getLastKnownLocation and onLocationChanged
This commit is contained in:
parent
fa490931ac
commit
3aad03b9ec
1 changed files with 2 additions and 9 deletions
|
|
@ -45,6 +45,8 @@ public class GPSExtractor {
|
|||
myLocationListener = new MyLocationListener();
|
||||
|
||||
locationManager.requestLocationUpdates(provider, 400, 1, myLocationListener);
|
||||
Location location = locationManager.getLastKnownLocation(provider);
|
||||
myLocationListener.onLocationChanged(location);
|
||||
}
|
||||
|
||||
protected void unregisterLocationManager() {
|
||||
|
|
@ -76,15 +78,6 @@ public class GPSExtractor {
|
|||
boolean gpsPrefEnabled = gpsPreferenceEnabled();
|
||||
|
||||
if (gpsPrefEnabled) {
|
||||
//If pref enabled, get current location
|
||||
Location location = locationManager.getLastKnownLocation(provider);
|
||||
|
||||
if (location != null) {
|
||||
myLocationListener.onLocationChanged(location);
|
||||
} 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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue