网站建设公司+长春,门户网站建站合同,网站建设陆金手指谷哥4,有域名如何搭建网站使用Location Service能帮助开发者为windows Phone 开发具备位置感知#xff08;Location-Aware)功能的应用程序。比如很多导航的软件#xff0c;查找附近吃饭、娱乐甚至厕所的应用程序#xff0c;都是基于这个服务的。 我们有3种方法来获取设备的位置。GPS#xff0c;移动… 使用Location Service能帮助开发者为windows Phone 开发具备位置感知Location-Aware)功能的应用程序。比如很多导航的软件查找附近吃饭、娱乐甚至厕所的应用程序都是基于这个服务的。 我们有3种方法来获取设备的位置。GPS移动网络基站位置和WiFi位置。下面的图是这三种方式的优缺点 需要注意的是windows phone会根据应用程序的需要选择一种或者多种方式来确定手机的位置。 三种方式确定位置的优点是有效的平衡电池的消耗与位置信息的准确性。 windows phone 为应用程序提供基于事件(event-driven)的统一接口。 使用地理位置服务的建议 想办法减低电池的消耗 a. 如果可以的话 使用那个较低准确率的数据源 b. 当需要的时候打开地理位置服务一旦使用完毕立刻关闭该服务。 设置准确率的门限值减低更新频率使用状态更新事件StatusChanged监控服务状态提醒用户状态的更新提醒用户初次启动地理位置服务时需要等待一段时间15秒到120秒。 使用位置服务 创建一个GeoCoordinateWatcher对象。创建一个事件处理程序处理用户位置的改变。在事件触发时抓取数据。 using System;using System.Collections.Generic;using System.Linq;using System.Net;using System.Windows;using System.Windows.Controls;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Animation;using System.Windows.Shapes;using Microsoft.Phone.Controls;using System.Device.Location;using Microsoft.Phone.Tasks;namespace Day13_LocationServices{publicpartialclass MainPage : PhoneApplicationPage { GeoCoordinateWatcher gcw;// Constructorpublic MainPage() { InitializeComponent(); gcw.PositionChanged new EventHandlerGeoPositionChangedEventArgsGeoCoordinate(gcw_PositionChanged); gcw.Start(); }void gcw_PositionChanged(object sender, GeoPositionChangedEventArgsGeoCoordinate e) { Latitude.Text e.Position.Location.Latitude.ToString(); Longitude.Text e.Position.Location.Longitude.ToString(); } }} 反应性扩展框架(Reactive Extensions) Reactive Extensions能够帮助应用程序把多种可监控的外部事件转换成异步消息外部事件包括数据流(data streams)异步请求(asynchronous requests)和事件(event)等使用Reactive Extensions当外部时间触发的时候应用程序得到异步的更新消息(asynchronous requests)Reactive Extensions允许应用程序使用查询(query)操作来对时间进行过滤。 如何使用Reactive Extensions可以参考msdn的这篇文章http://msdn.microsoft.com/en-us/library/ff637517(VS.92).aspx 参考资料How to: Get Data from the Location Service for Windows Phone http://msdn.microsoft.com/en-us/library/ff431782(vvs.92).aspx How to: Use Reactive Extensions to Emulate and Filter Location Data for Windows Phone http://msdn.microsoft.com/en-us/library/ff637517(VS.92).aspx Windows Phone 7 开发 31 日谈——第13日位置服务 http://www.cnblogs.com/porscheyin/archive/2010/12/23/1914300.html 转载于:https://www.cnblogs.com/zhangkai2237/archive/2012/02/20/2360619.html