Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Not able to find good code snippet for getting current device location using Xamarin forms

$
0
0

Hi
I am searching for small code snippet demo for getting current device location .

I tried follwoing code .

using PerpetualEngine.Location; //add package

Button btn = new Button ()
{
Text="SHow Loc",
Command=new Command(o=>smp.StartLocationUpdates(LocationAccuracy.High,1,TimeSpan.FromSeconds(5),TimeSpan.FromSeconds(1))),
};

        Label l1 = new Label () {
            Text="text lkjlksajflksad"


        };


        Content = new StackLayout { 
            Children = {

btn,l1
}
};

        smp.LocationUpdated += () => l1.Text = "New location:\n" + smp.LastLocation;

resolve


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>