public void onLocationChanged(Location location) { if (isBetterLocation(location, currentBestLocation)) { currentBestLocation = location; } locationGotCounterGps++; if ((locationGotCounterGps >= MEASURES_TO_ESTABLISH) && (!network_enabled)) { timer1.cancel(); Log.v(TAG, "gotLocation GPS"); locationResultListener.gotLocation(location); lm.removeUpdates(this); lm.removeUpdates(locationListenerNetwork); } }
public void onLocationChanged(Location location) { if (isBetterLocation(location, currentBestLocation)) { currentBestLocation = location; } locationGotCounterNetwork++; if ((locationGotCounterNetwork >= MEASURES_TO_ESTABLISH) && (!gps_enabled)) { timer1.cancel(); Log.v(TAG, "gotLocation NETWORK"); locationResultListener.gotLocation(location); lm.removeUpdates(this); // lm.removeUpdates(locationListenerGps); // don,t remove GPS location before // if found only NETWORK location } }