O'Reilly logo

Xamarin Studio for Android Programming: A C# Cookbook by Mathieu Nayrolles

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

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 ...

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