public Group search() throws FoursquareException, IOException {
Location location = mLocationListener.getLastKnownLocation();
Foursquare foursquare = ((Foursquared)getApplication()).getFoursquare();
String geolat;
String geolong;
int radius;
if (location == null) {
// Foursquare requires a lat, lng for a venue search, so we have to pull it from the
// server if we cannot determine it locally.
City city = foursquare.user(null, false, false).getCity();
geolat = String.valueOf(city.getGeolat());
geolong = String.valueOf(city.getGeolong());
radius = 1;
} else {
if (DEBUG) Log.d(TAG, "Searching with location: " + location);
geolat = String.valueOf(location.getLatitude());
geolong = String.valueOf(location.getLongitude());
if (location.hasAccuracy()) {
radius = (int)Math.round(location.getAccuracy() / (double)METERS_PER_MILE);
} else {
radius = 1;
}
}
return foursquare.venues(geolat, geolong, mSearchHolder.query, radius, 30);
}
}