【问题标题】:Application does not run in background, when we press window button当我们按下窗口按钮时,应用程序不会在后台运行
【发布时间】:2013-09-21 10:28:35
【问题描述】:

我在 Windows Phone 应用程序开发中遇到问题。 我想知道当我们按下window键时,我们的应用程序会停用,但为什么它没有在后台运行?

我实现了 Geolocator 方法并在 WMAppManifest.xml 文件中编写了以下文本

<Tasks>
      <DefaultTask Name="_default" NavigationPage="Registration.xaml">
        <BackgroundExecution>
          <ExecutionType Name="LocationTracking" />
        </BackgroundExecution>
      </DefaultTask>
    </Tasks>

在后台运行应用程序。

但只有在“设置”中打开 GPS 时,应用程序才会在后台运行。

【问题讨论】:

    标签: windows-phone-8 background gps location


    【解决方案1】:

    在 windows phone 中不可能在后台运行应用程序,只允许代理,但它们每 30 分钟启动一次,但我相信你已经知道了。虽然可以在锁屏下运行应用程序。

    【讨论】:

      【解决方案2】:

      这是一个功能。如果GeoCoordinateWatcher 没有主动跟踪位置,应用程序将从后台运行中停用。看Running location-tracking apps in the background for Windows Phone 8页面:

      操作系统将停用在后台运行的应用程序的条件:

      • 应用停止主动跟踪位置。应用程序通过删除 Geolocator 类的 PositionChanged 和 StatusChanged 事件的事件处理程序或调用 GeoCoordinateWatcher 类的 Stop() 方法来停止跟踪位置。

      • 应用已在后台运行 4 小时,没有用户交互。

      • 省电模式已启用。

      • 设备内存不足。

      • 用户在手机上禁用了定位服务。

      • 另一个应用程序开始在后台运行。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-06-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-10-26
        • 2019-12-30
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多