简体   繁体   中英

Xamarin.iOS geolocation

I have been browsing the web for a couple of hours to find ways to get the device's geolocation but to no avail.

I could find some documentation for android, but nothing for iOS. Anyone has any ideas or can point me to the right direction?

The Xamarin.Mobile component has a cross-platform GeoLocation service. It comes with samples.

Xamarin also has a Core Location sample app .

This question has also been asked and answered on Stack Overflow many times .

CLLocationManger lm = new CLLocationManger();
... (Acurray)
... (Other Specs)

lm.LocationsUpdated += delegate(object sender, CLLocationsUpdatedEventArgs e) {
    foreach(CLLocation l in e.Locations) {
        Console.WriteLine(l.Coordinate.Latitude.ToString() + ", " +l.Coordinate.Longitude.ToString());
    }
};

lm.StartUpdatingLocation();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM