private void refreshList() { // Wait up to 60 seconds for a fix, that is accurate to 300 meters and // is not older than 2 minutes. Integer accuracy; isFromRefresh = true; iCurrentPageNo = 2; // Emulator returns no accuracy, so ask for fix that is worse than our // default accuracy. if ("google_sdk".equals(Build.PRODUCT)) { accuracy = 551; } else { accuracy = 2000; } gps = GpsLocator.getGpsLocator(this); gpsFix = new GpsFix(60, accuracy, 259200); gpsFix.getFix(gps.getBestLocation()); // 'updateLocations(gps.getBestLocation()); if (gpsFix.getFix(gps.getBestLocation()) == GpsFixStatus.OK_FIX) { updateLocations(gps.getBestLocation()); } else { gps.addObserver(this); updateLocationView(null); } }
@Override public void onLocationUpdated(Location location) { // TODO Auto-generated method stub GpsFixStatus fixStatus = gpsFix.isAcceptableFix(location); Log.i("CHECKINFORGOOD", "Fix status: " + fixStatus.toString()); if (fixStatus == GpsFixStatus.OK_FIX) { updateLocations(location); gps.removeObserver(this); Log.i("CHECKINFORGOOD", "Location updated for business fragment"); } else if (fixStatus == GpsFixStatus.TIMED_OUT) { // Show location not found error page. Log.i("CHECKINFORGOOD", "Location not found"); } }