The next step is to add the ability to search for geographic locations on Flickr. To do this, you perform a regular search, but you also provide a latitude and longitude.
In Android, the location APIs pass around these location fixes in Location objects. So write a new buildUrl(…) override that takes in a Location object and builds an appropriate search query.
Listing 33.12 New buildUrl(Location)
(FlickrFetchr.java
)
private String buildUrl(String method, String query) { ... } private String buildUrl(Location location) { return ENDPOINT.buildUpon() .appendQueryParameter("method", SEARCH_METHOD) .appendQueryParameter("lat", "" + location.getLatitude()) .appendQueryParameter("lon", "" + location.getLongitude()) .build().toString(); }
And now write a matching searchPhotos(Location) method.