gpt4 book ai didi

java - 每天在特定时间运行代码

转载 作者:行者123 更新时间:2023-11-29 05:44:51 24 4
gpt4 key购买 nike

我想每天在 [user choice] 禁用服务并在 [user choice] 启用它。实现该目标的最佳方法是什么?

我应该使用日历吗? (计算开始和结束时间,还是别的?)

最佳答案

来自 Justin Breitfeller 对 Android Java - Creating a Cronjob 的回答:

The Android AlarmManager is the class you are looking for. It can trigger an intent to be sent to your application at set intervals so you can run any task you would like.

关于java - 每天在特定时间运行代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16202380/

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