O'Reilly logo

Xamarin Mobile Application Development for Android - Second Edition by Nilanchala Panigrahy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding location services to POIApp

In 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.
  • In 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:

  1. Declare a private instance of LocationManager and obtain a reference ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required