@Override public void onPause() { super.onPause(); // stop geolocation if (mGeolocation != null) mGeolocation.stop(); }
@Override public void onLocationChanged(Location location) { Logcat.d( "Geolocation.onLocationChanged(): " + location.getProvider() + " / " + location.getLatitude() + " / " + location.getLongitude() + " / " + new Date(location.getTime()).toString()); // check location age long timeDelta = System.currentTimeMillis() - location.getTime(); if (timeDelta > LOCATION_AGE) { Logcat.d("Geolocation.onLocationChanged(): gotten location is too old"); // gotten location is too old return; } // return location mCurrentLocation = new Location(location); stop(); GeolocationListener listener = mListener.get(); if (listener != null && location != null) listener.onGeolocationRespond(Geolocation.this, mCurrentLocation); }