Using GPS

GPS is used by many applications in order to localize the phone and propose recommendations or orientation depending on where the user is. In this recipe, we'll see how to retrieve the longitude and the latitude and then compute a street address.

Getting ready

To follow this recipe, create a new project called Gps, and you'll need to deploy your application on a physical phone as the emulator doesn't support GPS.

How to do it...

Here are the steps required to complete this recipe:

  1. Add four TextView elements to your Main.axml file, so it looks like the following:
    How to do it...
  2. Add using Android.Locations, using System.Collections.Generic, and using System.Text ...

Get Xamarin Studio for Android Programming: A C# Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.