你的位置:
首页
>
软件开发 >
操作系统 > Uwp Windows10获取设备位置(经纬度)
Uwp Windows10获取设备位置(经纬度)
发布时间:2016-10-12 12:00:25
先在Package.appxmanifest中配置位置权限 2. 创建LocationManager类 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using Sy ...
- 先在Package.appxmanifest中配置位置权限
2. 创建LocationManager类
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 using Windows.Devices.Geolocation; 7 8 namespace Weather 9 {10 public class LocationManager11 {12 public static async Task<Geoposition> GetPosition()13 {14 //请求位置访问权限15 var accessStatus = await Geolocator.RequestAccessAsync();16 //如果不允许就抛出异常17 if (accessStatus != GeolocationAccessStatus.Allowed) throw new Exception();18 //实例类19 var geolocator = new Geolocator { DesiredAccuracyInMeters = 0 };20 //获取设备位置21 var position = await geolocator.GetGeopositionAsync();22 //返回位置信息23 return position;24 }25 }26 }
原标题:Uwp Windows10获取设备位置(经纬度)
关键词:Windows
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。
江苏民航东源大酒店:https://www.vstour.cn/t/江苏民航东源大酒店.html
江苏哪家旅游公司好:https://www.vstour.cn/t/江苏哪家旅游公司好.html
江苏哪里好玩又便宜:https://www.vstour.cn/t/江苏哪里好玩又便宜.html
江苏南京旅游景点:https://www.vstour.cn/t/江苏南京旅游景点.html
江苏骑行路线:https://www.vstour.cn/t/江苏骑行路线.html
江苏人在深圳:https://www.vstour.cn/t/江苏人在深圳.html
珠海长隆横琴剧院具体地址:https://www.vstour.cn/a/334167.html
珠海长隆横琴剧院演出时间:https://www.vstour.cn/a/334168.html