gpt4 book ai didi

java - 在我的应用程序关闭时安排任务

转载 作者:行者123 更新时间:2023-11-30 11:25:09 26 4
gpt4 key购买 nike

示例场景:

我的应用用户计划在一个小时后执行某项任务。

用户关闭应用。

应用程序如何知道何时执行作业?我如何安排一个程序每隔 x 次运行一次?

此外,什么是正确的做法 - 将应用程序主程序(带 UI)和后台进程分开或成为同一个程序(考虑到后台程序不更改 UI)?

谢谢

最佳答案

how can i Schedule a progran to run every x time?

Use AlarmManager .

What is the right practice - make the app main program (with UI) and the background process saparate or be the same program

请使其成为同一个程序。

关于java - 在我的应用程序关闭时安排任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20442853/

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