UWP background task location tracking

不问归期 提交于 2019-12-11 15:16:29

问题


I'm trying to develop an UWP app that is able to continually track the user's location in an in-process background task. I've been looking at the Microsoft sample code on GitHub (geolocation / Secenario3_BackgroundTask) but the problem there is that it is based on a TimeTrigger. The shortest interval that TimeTrigger allows is 15 minutes, but I need to get location updates much more frequently. Let's say at least once per minute. Is that possible at all?

I've seen that there is a LocationTrigger but there's not much documentation for it. I don't understand when this trigger gets fired. In my tests, it never got fired.


回答1:


LocationTrigger is used for Geofencing, it is triggered when a mobile device enters or leaves a particular area.

As you say, TimeTrigger is not good for your requirement because it has an interval of 15 minutes at the minimum.

Windows 10 introduces a new mechanism called extended execution. Location tracking is one of the supported scenarios in which you ask the OS to keep your app running when another app is switched to the foreground.

This is a sample for your.



来源:https://stackoverflow.com/questions/46726901/uwp-background-task-location-tracking

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!