gpt4 book ai didi

android - 如何确保应用程序处于后台模式时 Flutter 进程不会被终止

转载 作者:行者123 更新时间:2023-11-29 05:47:59 27 4
gpt4 key购买 nike

有一个装置可以在一夜之间收集数据。它将数据发送到 Flutter 应用程序,该应用程序将数据上传到服务器。当应用程序长时间处于后台模式时,我该如何确保传输进程保持 Activity 状态并且不会被终止?

最佳答案

这与 Flutter 无关!而是iOS系统。因此,您需要了解 iOS 如何或何时 iOS 将暂停/为正在运行的应用程序提供更多时间。

Most apps can move to the suspended state easily enough but there are also legitimate reasons for apps to continue running in the background... When you find it necessary to keep your app running in the background, iOS helps you do so efficiently and without draining system resources or the user’s battery. The techniques offered by iOS fall into three categories:

  • Apps that start a short task in the foreground can ask for time to finish that task when the app moves to the background.
  • Apps that initiate downloads in the foreground can hand off management of those downloads to the system, thereby allowing the app to be suspended or terminated while the download continues.
  • Apps that need to run in the background to support specific types of tasks can declare their support for one or more background execution modes.

文档:https://developer.apple.com/library/archive/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html

关于android - 如何确保应用程序处于后台模式时 Flutter 进程不会被终止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55959925/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com