Sequenceablepublic class NotificationSubscribeInfo extends Object implements Sequenceable
After you set the filter criteria in a NotificationSubscribeInfo object, you can use it
to subscribe to or unsubscribe from notifications only from publishers meeting the filter criteria.
only the system app can subscribe or unsubscribe notifications.
NotificationHelperSystemCapability.Notification#ANSSequenceable.Producer<T>| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static Sequenceable.Producer<NotificationSubscribeInfo> |
PRODUCER |
Creates a
NotificationSubscribeInfo instance from a Parcel. |
| 构造器 | 说明 |
|---|---|
NotificationSubscribeInfo() |
Default constructor used to create an empty
NotificationSubscribeInfo instance. |
NotificationSubscribeInfo(NotificationSubscribeInfo subscribeInfo) |
A constructor used to create a
NotificationSubscribeInfo instance by copying parameters from
an existing one. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
NotificationSubscribeInfo |
addAppName(String appName) |
Sets a single application name as the filter criterion, which means to subscribe to notifications
of this application.
|
NotificationSubscribeInfo |
addAppNames(String[] appNames) |
Sets multiple application names as the filter criteria, which means to subscribe to notifications
of these applications.
|
Set<String> |
getAppNames() |
Obtains the application names in the current
NotificationSubscribeInfo object. |
boolean |
marshalling(Parcel out) |
Marshals a
NotificationSubscribeInfo object into a Parcel. |
String |
toString() |
Returns a string representation of the object.
|
boolean |
unmarshalling(Parcel in) |
Unmarshals a
NotificationSubscribeInfo object from a Parcel. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waithasFileDescriptorpublic static final Sequenceable.Producer<NotificationSubscribeInfo> PRODUCER
NotificationSubscribeInfo instance from a Parcel.public NotificationSubscribeInfo()
NotificationSubscribeInfo instance.public NotificationSubscribeInfo(NotificationSubscribeInfo subscribeInfo)
NotificationSubscribeInfo instance by copying parameters from
an existing one.subscribeInfo - Indicates the NotificationSubscribeInfo object.public Set<String> getAppNames()
NotificationSubscribeInfo object.
The application names can be set by calling addAppName(java.lang.String) or addAppNames(java.lang.String[]).public NotificationSubscribeInfo addAppName(String appName)
appName - Indicates the application name.NotificationSubscribeInfo object with the specified appName.public NotificationSubscribeInfo addAppNames(String[] appNames)
appNames - Indicates the set of application names.NotificationSubscribeInfo object with the specified appNames.public boolean marshalling(Parcel out)
NotificationSubscribeInfo object into a Parcel.
A process can call the unmarshalling(ohos.utils.Parcel) method to unmarshal a
NotificationSubscribeInfo object from a Parcel to implement
inter-process communication (IPC).
marshalling 在接口中 Sequenceableout - Indicates the Parcel object for marshalling.true if the marshalling is successful; returns false otherwise.public boolean unmarshalling(Parcel in)
NotificationSubscribeInfo object from a Parcel.unmarshalling 在接口中 Sequenceablein - Indicates the Parcel object for unmarshalling.true if the unmarshalling is successful; returns false otherwise.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())