gpt4 book ai didi

android - 让 JobScheduler 和 JobInfo.Builder 在特定和准确的时间运行?

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:48:34 25 4
gpt4 key购买 nike

我正在尝试创建一个在特定时间发送通知的应用程序。我正在查看带有 JobInfo.Builder 的 JobScheduler API,但是当我查看此页面时:

https://developer.android.com/reference/android/app/job/JobInfo.Builder.html

我看到 setPeriodic 方法说:

Specify that this job should recur with the provided interval, not more than once per period. You have no control over when within this interval this job will be executed

所以看起来这个方法会在设定的时间内随机完成任务。

如何使用 JobScheduler API 将任务设置为在准确的时间发生?

最佳答案

How can I use the JobScheduler API to set a task to happen at an exact time?

你不知道。 JobScheduler 专为不精确的计时而设计,因此它可以组合来自多个应用程序的作业,以尽量降低功耗。

您最好的选择是 AlarmManager

关于android - 让 JobScheduler 和 JobInfo.Builder 在特定和准确的时间运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39196221/

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