如何不精确是setInexactRepeating()的AlarmManager?

编程入门 行业动态 更新时间:2024-10-22 07:29:13
本文介绍了如何不精确是setInexactRepeating()的AlarmManager?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

所以这里的交易...我有沉默用户的电话时,他们有一流的。所以,我需要警报以每日熄灭在特定的时间,为每个类。

So here's the deal... I've got to silence the user's phone when they have class. So I need an alarm to go off daily at a specific time, for each class.

所以,我想每个班级都有自己的报警(一天的时间间隔设置)。如果类是在会话中的present一天,电话是沉默。

So I'm thinking every class has their own alarm (interval set for a day). And the phone is silenced if class is in session the present day.

下面是我目前的code:

Here's my current code:

am.setInexactRepeating(AlarmManager.RTC_WAKEUP, startTime, DAY_IN_MILLISECONDS, start);

威尔setInexactRepeating()是足够精确到几分钟过了一天的时间间隔内沉默了电话?

推荐答案

大概不会,特别是如果这是一整天的时间。

Probably not, especially if that's an interval of an entire day.

在documentation:

您报警的第一个触发器会不会要求的时间前,但这可能不会发生,几乎到时候经过整整间隔。此外,虽然重复报警的总体期间将被请求,报警的任何两个连续的点火之间的时间可以变化。如果你的应用需求非常低的抖动,使用setRepeating(INT,很长很长,PendingIntent)来代替。

Your alarm's first trigger will not be before the requested time, but it might not occur for almost a full interval after that time. In addition, while the overall period of the repeating alarm will be as requested, the time between any two successive firings of the alarm may vary. If your application demands very low jitter, use setRepeating(int, long, long, PendingIntent) instead.

更多推荐

如何不精确是setInexactRepeating()的AlarmManager?

本文发布于:2023-11-27 04:22:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1636573.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不精确   setInexactRepeating   AlarmManager

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!