Skip to content

Instantly share code, notes, and snippets.

@juucustodio
Created August 7, 2017 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juucustodio/257fa4f92c4a7dfe4bc6f4bf0235acc2 to your computer and use it in GitHub Desktop.
Save juucustodio/257fa4f92c4a7dfe4bc6f4bf0235acc2 to your computer and use it in GitHub Desktop.
Demo de utilização do GPS - Xamarin.Forms
using Plugin.Geolocator;
using System;
using Xamarin.Forms;
namespace DemoGPS
{
public partial class MainPageDemoGPS : ContentPage
{
public MainPageDemoGPS()
{
InitializeComponent();
}
private async void GetPosition(object sender, EventArgs e)
{
var locator = CrossGeolocator.Current;
locator.DesiredAccuracy = 50;
var position = await locator.GetPositionAsync(TimeSpan.FromSeconds(10));
LongitudeLabel.Text = string.Format("{0:0.0000000}", position.Longitude);
LatitudeLabel.Text = string.Format("{0:0.0000000}", position.Latitude);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment