Comparable<ReminderRequest>, Sequenceablepublic abstract class ReminderRequest extends Object implements Sequenceable, Comparable<ReminderRequest>
Third-party applications can use this class to create scheduled reminders, including those for countdown timers, calendar events, and active alarm clocks.
After this class is called, the timing and pop-up notification functions of the calling application will
be performed by the system service agent in the background, even when the application is frozen or exits.
You can call the ReminderRequest#setIntentAgent(String, String) method to specify whether to start the
application after the pop-up notification is taped.
Sequenceable.Producer<T>| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static int |
ACTION_BUTTON_TYPE_CLOSE |
ActionButton type, indicates that this action button is used to close reminder's notification.
|
static int |
ACTION_BUTTON_TYPE_SNOOZE |
ActionButton type, indicates that this action button is used to snooze reminder.
|
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
int |
compareTo(ReminderRequest other) |
Sorted by ascending order of triggerTime(RTC).
|
boolean |
equals(Object obj) |
Indicates whether some other object is "equal to" this one.
|
String |
getContent() |
Obtains the content of this reminder.
|
String |
getExpiredContent() |
Obtains the extended content displayed when this reminder expires.
|
int |
getNotificationId() |
Obtains the notification ID used by this reminder.
|
long |
getRingDuration() |
Obtains the ringing or vibration duration configured for this reminder.
|
String |
getSlotId() |
Obtains the slot ID used by this reminder.
|
String |
getSnoozeContent() |
Obtains the extended content displayed when this reminder is snoozing.
|
int |
getSnoozeTimes() |
Obtains the number of times this reminder will be automatically snoozed.
|
long |
getTimeInterval() |
Obtains the snooze interval of this reminder.
|
String |
getTitle() |
Obtains the title of this reminder.
|
int |
hashCode() |
Returns a hash code value for the object.
|
boolean |
marshalling(Parcel out) |
Marshals this
Sequenceable object into a Parcel. |
ReminderRequest |
setActionButton(String title,
int type) |
Adds a
NotificationActionButton to the pop-up notification screen of this reminder. |
ReminderRequest |
setContent(String content) |
Sets the content of this reminder.
|
ReminderRequest |
setExpiredContent(String expiredContent) |
Sets the extended content to be displayed when this reminder expires.
|
ReminderRequest |
setIntentAgent(String pkgName,
String abilityName) |
Sets information about the target ability to be redirected to after the user taps the notification
displayed for this reminder.
|
ReminderRequest |
setMaxScreenIntentAgent(String pkgName,
String abilityName) |
Sets the ability to be started based on the given
maxScreenIntentAgent when the device is not
in use, instead of showing a notification for this reminder in the status bar. |
ReminderRequest |
setNotificationId(int notificationId) |
Sets the notification ID for this reminder.
|
ReminderRequest |
setRingDuration(long ringDurationInSeconds) |
Sets the ringing or vibration duration for this reminder, in seconds.
|
ReminderRequest |
setSlotId(String slotId) |
Sets the slot ID for this reminder.
|
ReminderRequest |
setSnoozeContent(String snoozeContent) |
Sets the extended content to be displayed when this reminder is snoozing.
|
ReminderRequest |
setSnoozeTimes(int snoozeTimes) |
Sets the number of snooze times for this reminder.
|
ReminderRequest |
setTimeInterval(long timeIntervalInSeconds) |
Sets the snooze interval for this reminder, in seconds.
|
ReminderRequest |
setTitle(String title) |
Sets the title of this reminder.
|
String |
toString() |
Returns a string representation of the object.
|
boolean |
unmarshalling(Parcel in) |
Unmarshals this
Sequenceable object from a Parcel. |
hasFileDescriptorpublic static final int ACTION_BUTTON_TYPE_CLOSE
public static final int ACTION_BUTTON_TYPE_SNOOZE
public long getRingDuration()
public ReminderRequest setRingDuration(long ringDurationInSeconds)
ringDurationInSeconds - Indicates the alarm duration to set. The default duration is 1 second.
ringDuration is less than 0, the setting does not take effect,
and the default value 1 is used.ringDuration is greater than 0, the device keeps ringing or vibrating
for the specified number of seconds. ReminderRequest instance.public int getSnoozeTimes()
public ReminderRequest setSnoozeTimes(int snoozeTimes)
snoozeTimes is less than or equal to 0, this reminder is a one-shot
reminder and will not be snoozed. snoozeTimes is greater than 0, for example, 3, this reminder will be
snoozed three times after the first alarm, that is, this reminder will be triggered for four times.snoozeTimes - Indicates the number of times that the reminder will be snoozed.ReminderRequest instance.public long getTimeInterval()
public ReminderRequest setTimeInterval(long timeIntervalInSeconds)
0.
ReminderRequestTimer
timeIntervalInSeconds - Indicates the snooze interval to set. If the value is less than or equal to 0,
the reminder will not be snoozed.ReminderRequest instance.public String getTitle()
public ReminderRequest setTitle(String title)
title - Indicates the title to display.ReminderRequest instance.public String getContent()
public ReminderRequest setContent(String content)
content - Indicates the content to display.ReminderRequest instance.public String getExpiredContent()
public ReminderRequest setExpiredContent(String expiredContent)
expiredContent - Indicates the extended content to be displayed when this reminder expires,
for example, "Expired".ReminderRequest instance.public String getSnoozeContent()
public ReminderRequest setSnoozeContent(String snoozeContent)
snoozeContent - Indicates the extended content to be displayed when this reminder is snoozing,
for example, "Remind later".ReminderRequest instance.public int getNotificationId()
NotificationRequest.getNotificationId()public ReminderRequest setNotificationId(int notificationId)
notificationId - Indicates the notification ID to set.ReminderRequest instance.NotificationRequest.setNotificationId(int)public String getSlotId()
NotificationRequest.getSlotId()public ReminderRequest setSlotId(String slotId)
slotId - Indicates the slot ID to set.ReminderRequest instance.NotificationRequest.setSlotId(String)public ReminderRequest setActionButton(String title, int type)
NotificationActionButton to the pop-up notification screen of this reminder. The system
typically places action buttons below the notification content.
Icons cannot be configured for NotificationActionButtons.
The system automatically sets an IntentAgent for the NotificationActionButton
instance based on the value of the type parameter.
A maximum of two NotificationActionButton instances can be added for each reminder.
One NotificationActionButton is of the ACTION_BUTTON_TYPE_CLOSE type, and the other
is of the ACTION_BUTTON_TYPE_SNOOZE type.
title - Indicates the button name.type - Indicates the type of the action button to add, which can be ACTION_BUTTON_TYPE_CLOSE
or ACTION_BUTTON_TYPE_SNOOZE.ReminderRequest instance.public ReminderRequest setMaxScreenIntentAgent(String pkgName, String abilityName)
maxScreenIntentAgent when the device is not
in use, instead of showing a notification for this reminder in the status bar.
When the device is in use, the system UI displays a pop-up notification instead of starting the
ability specified by maxScreenIntentAgent.
Before calling this method, the application must have been granted the
ohos.permission.USE_WHOLE_SCREEN permission.
pkgName - Indicates the HAP package name of the target ability.abilityName - Indicates the name of the target ability.ReminderRequest instance.public boolean marshalling(Parcel out)
SequenceableSequenceable object into a Parcel.marshalling 在接口中 Sequenceableout - Indicates the Parcel object to which the Sequenceable
object will be marshaled..true if the marshalling is successful; returns false otherwise.public boolean unmarshalling(Parcel in)
SequenceableSequenceable object from a Parcel.unmarshalling 在接口中 Sequenceablein - Indicates the Parcel object into which the Sequenceable
object has been marshaled.true if the unmarshalling is successful; returns false otherwise.public int compareTo(ReminderRequest other)
compareTo 在接口中 Comparable<ReminderRequest>other - Indicate the object to compare to.public boolean equals(Object obj)
Object
The equals method implements an equivalence relation
on non-null object references:
x, x.equals(x) should return
true.
x and y, x.equals(y)
should return true if and only if
y.equals(x) returns true.
x, y, and z, if
x.equals(y) returns true and
y.equals(z) returns true, then
x.equals(z) should return true.
x and y, multiple invocations of
x.equals(y) consistently return true
or consistently return false, provided no
information used in equals comparisons on the
objects is modified.
x,
x.equals(null) should return false.
The equals method for class Object implements
the most discriminating possible equivalence relation on objects;
that is, for any non-null reference values x and
y, this method returns true if and only
if x and y refer to the same object
(x == y has the value true).
Note that it is generally necessary to override the hashCode
method whenever this method is overridden, so as to maintain the
general contract for the hashCode method, which states
that equal objects must have equal hash codes.
equals 在类中 Objectobj - the reference object with which to compare.true if this object is the same as the obj
argument; false otherwise.Object.hashCode(),
HashMappublic int hashCode()
ObjectHashMap.
The general contract of hashCode is:
hashCode method
must consistently return the same integer, provided no information
used in equals comparisons on the object is modified.
This integer need not remain consistent from one execution of an
application to another execution of the same application.
equals(Object)
method, then calling the hashCode method on each of
the two objects must produce the same integer result.
Object.equals(java.lang.Object)
method, then calling the hashCode method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hash tables.
As much as is reasonably practical, the hashCode method defined by
class Object does return distinct integers for distinct
objects. (This is typically implemented by converting the internal
address of the object into an integer, but this implementation
technique is not required by the
Java™ programming language.)
hashCode 在类中 ObjectObject.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)public String toString()
ObjecttoString method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
public ReminderRequest setIntentAgent(String pkgName, String abilityName)
After the user taps the notification, the IntentAgent will be triggered to start the
specified ability.
pkgName - Indicates the HAP package name of the target ability.abilityName - Indicates the name of the target ability.ReminderRequest instance.