January 2017
Beginner to intermediate
624 pages
22h 42m
English
Now that you have a location fix, it is time to use it. Write an async task to find a GalleryItem near your location fix, download its associated image, and display it.
Put this code inside a new inner AsyncTask called SearchTask. Start by performing the search, selecting the first GalleryItem that comes up.
Listing 33.22 Writing SearchTask (LocatrFragment.java)
private void findImage() {
...
LocationServices.FusedLocationApi
.requestLocationUpdates(mClient, request, new LocationListener() {
@Override
public void onLocationChanged(Location location) {
Log.i(TAG, "Got a fix: " + location);
new SearchTask().execute(location); } }); } private boolean hasLocationPermission() { int result = ContextCompat ...Read now
Unlock full access