0

Geolocator in ScheduledAgent always give me old value position: var position = await geolocator.GetGeopositionAsync(); this position will always be the same. It was similar question - ScheduledAgent and GeoCoordinateWatcher - how to make them work? But it is too old, may there are some changes.

4

1 回答 1

1

根据这个http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202962(v=vs.105).aspx#BKMK_NoteworthyAPIsforUsewithScheduledTasks

地理坐标观察器:

此 API 用于获取设备的地理坐标,支持在后台代理中使用,但它使用缓存的位置值而不是实时数据。缓存的位置值由设备每 15 分钟更新一次。

我认为,Geolocator 使用相同的 API。我已经启动了我的测试应用程序,它返回相同的位置 15 分钟,之后它返回了新的位置(我在预定代理完成第一个位置跟踪后立即设置)。

为了测试我正在使用这个代码:

#if DEBUG_AGENT
            ScheduledActionService.LaunchForTest(task.Name, TimeSpan.FromSeconds(30));
#endif

计划代理的间隔为 30 分钟,这就是为什么如果没有此代码进行测试,位置跟踪的行为将是常态。

于 2013-07-25T10:45:32.560 回答