Adding location services to POIApp
POIApp, we have the following two different scenarios for requesting location updates:
- In the POI list, we need to calculate the distance of each of the listed POIs. In this scenario, we want to request location change notifications on an ongoing basis and use the most current location to calculate the distance.
POIDetailFragment, we would like to request the current location when adding a new POI. In this scenario, we would want to request a single location change notification.
Adding location services to the POI list
Now that we have some idea of how to add location services to an app, let's add location services to
POIListFragment as follows:
- Declare a private instance of
LocationManagerand obtain a reference ...