ios上周期小于15分钟的后台作业 [英] Background job with period lower than 15 minutes on ios

查看:31
本文介绍了ios上周期小于15分钟的后台作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用 React Native 为 ios 构建一个应用程序.

I am building an app for ios in react native.

使用 react-native-background-task 我是运行从服务器获取数据的任务.
在 IOS 上,默认和最短时间为 15 分钟,这对于我的需要来说太高了.
有没有办法在IOS上创建一个周期较短的后台任务?

Using the react-native-background-task I am running a task that fetches data from a server.
On IOS the default and lowest period is 15 minutes, which is too high for what I need.
Is there a way to create a background task on IOS with a lower period?

推荐答案

简短的回答是你不能.

iOS 不支持在后台频繁轮询,因为它对电池或网络不友好.

iOS does not support frequently polling in the background as it is not battery or network friendly.

该模块使用 iOS 后台提取服务,这是 iOS 上唯一支持的后台提取工具.

That module uses the iOS background fetch service which is the only supported background fetch facility on iOS.

通过后台提取,iOS 会在确定时调用您的后台提取处理程序.这可能甚至少于 15 分钟;您提供的时间间隔只是请求的时间间隔,并且会根据您的服务器返回新数据的频率和时间以及其他因素进行修改.

With background fetch, iOS invokes you background fetch handler when it determines. This may be even less frequently than 15 minutes; the time interval you supply is a requested interval only and will be modified based on how often and when you server returns new data and other factors.

首选方法是在您的服务器有新数据时使用推送通知.

The preferred approach is to use a push notification when your server has new data.

这篇关于ios上周期小于15分钟的后台作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆