windows10 uwp获取设备当前地理位置(经纬度)
2021-05-12 07:26
标签:ons cti window read generic ati style threading system 实例化: var position = await LocationManager.GetPosition(); 通过position.Coordinate.Longitude,position.Coordinate.Latitude属性获得经纬度。 windows10 uwp获取设备当前地理位置(经纬度) 标签:ons cti window read generic ati style threading system 原文地址:http://www.cnblogs.com/rendan/p/7581469.htmlusing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Devices.Geolocation;//引用此命名空间
namespace SimpleWeather
{
public class LocationManager
{
public async static TaskGetPosition()
{
var accessStatus = await Geolocator.RequestAccessAsync();
if (accessStatus != GeolocationAccessStatus.Allowed) throw new Exception();
var geolocator = new Geolocator { DesiredAccuracyInMeters = 0 };
var position = await geolocator.GetGeopositionAsync();
return position;
}
}
}
上一篇:php请求相关
文章标题:windows10 uwp获取设备当前地理位置(经纬度)
文章链接:http://soscw.com/index.php/essay/84578.html