如何减少Workmanager Android的时间? [英] How to decrease time period of Workmanager Android?

查看:70
本文介绍了如何减少Workmanager Android的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在检查其他链接,stackoverflow以减少工作管理器的时间,但是我发现下面的链接

如何在WorkManager中减少PeriodicWorkManager的时间

上面的链接说,最短时间为15分钟.

需要立即将数据从移动设备发送到服务器.是否有其他方法可以缩短时间?

请帮助我.谢谢.

解决方案

如果您想一次将数据从Mobile立即发送到服务器,请使用OneTimeWorkRequestBuilder,否则请使用ForeGround Service而不是WorkManager将连续数据上传发送到服务器./p>

这两种策略都将确保在服务器端上传数据.并且,如果繁重的上传工作可能需要超过10分钟的时间,请务必使用ForeGround服务.

I have been checking with the other links, stackoverflow to reduce time period of Work manager, but I found below link

How to reduce time of PeriodicWorkManager in WorkManager

Above link says that minimum time is 15 minutes.

Need to send data instantly from mobile to server. Is there any alternative for reducing the time period ?

Please help me on this.Thanks in Advance.

解决方案

If you want to send Data instantly from Mobile to Server one time then use OneTimeWorkRequestBuilder , otherwise use ForeGround Service instead of WorkManager for sending continuous data upload to server.

Both of these strategy will ensure the data upload at server side. And if it is heavy upload work which may take longer than 10 minutes , please use ForeGround Service definitely.

这篇关于如何减少Workmanager Android的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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