【问题标题】:Headless tasks in React-Native timeout (Android)React-Native 超时(Android)中的无头任务
【发布时间】:2020-01-27 09:56:40
【问题描述】:

我在 RN android 中使用无头任务,但我不明白一件事,超时,这是否意味着我希望后台进程工作多长时间?我想在调用 stopService 之前一直工作,所以我必须在那里指定超时时间吗?

 return new HeadlessJsTaskConfig("headless_task", data, 5000, // timeout for the task
            true // optional: defines whether or not the task is allowed in foreground. Default
                 // is false
    );

【问题讨论】:

    标签: java android react-native background-process headless


    【解决方案1】:

    是的。超时是该任务将处于活动状态的时间。最长为 10 分钟。如果是定期任务,则最小间隔为 15 分钟。所以有一个强制性的 5 分钟停机时间。只需在第一个任务的停机时间内启动另一个任务,并让它接管该过程。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-21
      • 1970-01-01
      • 2021-05-03
      • 2021-09-24
      • 2019-08-04
      • 1970-01-01
      • 2023-02-22
      • 1970-01-01
      相关资源
      最近更新 更多