openharmony 鸿蒙 js-apis-inner-commonEvent-commonEventSubscribeInfo

2025-06-12 浏览 (1)

CommonEventSubscribeInfo

The CommonEventSubscribeInfo module provides APIs for providing subscriber information.

NOTE

The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.

After users subscribing to custom common events, any application can send potential malicious common events to subscribers. Use the publisherPermission and publisherBundleName parameters of this module to restrict the publishing scope of common events.

Attributes

Atomic service API: This API can be used in atomic services since API version 11.

System capability: SystemCapability.Notification.CommonEvent

NameTypeRead OnlyOptionalDescription
eventsArray<string>NoNoCommon events to subscribe to.
publisherPermissionstringNoYesPermission of the publisher. The subscriber can receive only the events from the publisher with this permission.
publisherDeviceIdstringNoYesDevice ID. Use @ohos.deviceInfo to obtain the UDID as the device ID of the subscriber. Not supported currently.
userIdnumberNoYesUser ID. If this parameter is not specified, the default value, which is the ID of the current user, will be used. The value must be an existing user ID in the system. Use getOsAccountLocalId to obtain the system account ID and use it as the user ID of the subscriber.
prioritynumberNoYesSubscriber priority. The value ranges from –100 to +1000. If the value exceeds the upper or lower limit, the upper or lower limit is used.
publisherBundleName11+stringNoYesBundle name of the publisher to subscribe to.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Basic Services Kit

harmony 鸿蒙DeviceInfo

harmony 鸿蒙InitSync

harmony 鸿蒙OH_Print

harmony 鸿蒙OsAccount

harmony 鸿蒙Pasteboard

harmony 鸿蒙Print_Margin

harmony 鸿蒙Print_PageSize

harmony 鸿蒙Print_PrintAttributes

harmony 鸿蒙Print_PrintDocCallback

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/gvJ2Nx