鸿蒙OS ReminderRequestCalendar

2022-10-13 10:24 更新

ReminderRequestCalendar

java.lang.Object

|---ohos.event.notification.ReminderRequest

|---|---ohos.event.notification.ReminderRequestCalendar

public class ReminderRequestCalendar
extends ReminderRequest

用于为日历事件创建提醒的 ReminderRequest 子类。

您可以使用此类在特定日期或特定月份的特定日期的指定时间(精确到分钟)发布日历事件提醒。

Since:

6

嵌套类摘要

从接口 ohos.utils.Sequenceable 继承的嵌套类/接口
Sequenceable.ProducerT

字段摘要

从类 ohos.event.notification.ReminderRequest 继承的字段
ACTION_BUTTON_TYPE_CLOSE, ACTION_BUTTON_TYPE_SNOOZE

构造函数摘要

构造函数 描述
ReminderRequestCalendar(LocalDateTime dateTime, int[] repeatMonths, int[] repeatDays) 用于创建 ReminderRequestCalendar 实例的构造函数。

方法总结

修饰符和类型 方法 描述
boolean marshalling(Parcel out) 将此 Sequenceable 对象编组为 Parcel。
boolean unmarshalling(Parcel in) 从 Parcel 中解组此 Sequenceable 对象。
从类 java.lang.Object 继承的方法
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
从类 ohos.event.notification.ReminderRequest 继承的方法
compareTo, equals, getContent, getExpiredContent, getNotificationId, getRingDuration, getSlotId, getSnoozeContent, getSnoozeTimes, getTimeInterval, getTitle, hashCode, setActionButton, setContent, setExpiredContent, setIntentAgent, setMaxScreenIntentAgent, setNotificationId, setRingDuration, setSlotId, setSnoozeContent, setSnoozeTimes, setTimeInterval, setTitle, toString
从接口 ohos.utils.Sequenceable 继承的方法
hasFileDescriptor

构造函数详细信息

ReminderRequestCalendar

public ReminderRequestCalendar(LocalDateTime dateTime, int[] repeatMonths, int[] repeatDays)

用于创建 ReminderRequestCalendar 实例的构造函数。 日历事件提醒将在指定时间触发。

确保输入参数满足以下要求。 否则,应用程序可能会因为非法参数异常而崩溃。

  • dateTime 参数不能为空。
  • repeatMonths 参数不能为空。
  • repeatDays 参数不能为空。
  • repeatMonths 数组的长度不能超过 12。
  • repeatDays 数组的长度不能超过 31。
  • 必须至少有一个有效的提醒时间。 确保 dateTime 指定的时间没有过期,或者 repeatMonths 和 repeatDays 有效。

参数:

参数名称 参数描述
dateTime 指示将触发此日历事件提醒的日期和时间。 时间精确到分钟。 例如,LocalDateTime.of(2021, 3, 3, 16, 15) 的值表示提醒将在 2021 年 3 月 3 日 16:15 触发。
repeatMonths 指示重复此提醒的月份。 例如,值 {2, 4} 表示提醒将在 2 月和 4 月的特定日期触发。
repeatDays 指示每月重复此提醒的日期。 例如,值 {2, 4} 表示将在特定月份的第二天和第四天触发提醒。 必须同时设置repeatMonths 和repeatDays 参数才能实现重复提醒。 默认情况下,此提醒不会被延后。 您可以调用 ReminderRequest.setTimeInterval(long) 来设置贪睡间隔。 如果设置了打盹间隔,该提醒会默认打盹3次。 您可以调用 ReminderRequest.setSnoozeTimes(int) 来更改贪睡时间。

Since:

6

方法详情

marshalling

public boolean marshalling(Parcel out)

从接口复制的描述:Sequenceable

将此 Sequenceable 对象编组为 Parcel。

指定者:

接口 Sequenceable 中的编组

覆盖:

在类 ReminderRequest 中编组

参数:

参数名称 参数描述
out 指示将 Sequenceable 对象编组到的 Parcel 对象。

返回:

如果编组成功,则返回 true; 否则返回 false。

unmarshalling

public boolean unmarshalling(Parcel in)

从接口复制的描述:Sequenceable

从 Parcel 中解组此 Sequenceable 对象。

指定者:

在接口 Sequenceable 中解组

覆盖:

在 ReminderRequest 类中解组

参数:

参数名称 参数描述
in 指示已将 Sequenceable 对象编组到的 Parcel 对象。

返回:

如果解组成功,则返回 true; 否则返回 false。

以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号