提交 627f45d2 编写于 作者: E ester.zhou

Update docs (12918)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 06f08ef1
# System Common Events
This document provides indexes for system common events defined in OpenHarmony.
For details about the definition of a system common event, see [Support in @ohos.commonEvent (Common Event)](./js-apis-commonEvent.md#support).
**System capability**: SystemCapability.Notification.CommonEvent
## COMMON_EVENT_BOOT_COMPLETED
Indicates that the user has finished booting and the system has been loaded.
- Value: **usual.event.BOOT_COMPLETED**
- Required subscriber permissions: ohos.permission.RECEIVER_STARTUP_COMPLETED
## COMMON_EVENT_LOCKED_BOOT_COMPLETED
(Reserved, not supported yet) Indicates that the user has finished booting and the system has been loaded but the screen is still locked.
- Value: **usual.event.LOCKED_BOOT_COMPLETED**
- Required subscriber permissions: ohos.permission.RECEIVER_STARTUP_COMPLETED
## COMMON_EVENT_SHUTDOWN
Indicates that the device is being shut down and the final shutdown will proceed.
- Value: **usual.event.SHUTDOWN**
- Required subscriber permissions: none
## COMMON_EVENT_BATTERY_CHANGED
Indicates that the charging state, level, and other information about the battery have changed.
- Value: **usual.event.BATTERY_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_BATTERY_LOW
Indicates that the battery level is low.
- Value: **usual.event.BATTERY_LOW**
- Required subscriber permissions: none
## COMMON_EVENT_BATTERY_OKAY
Indicates that the battery level is normal.
- Value: **usual.event.BATTERY_OKAY**
- Required subscriber permissions: none
## COMMON_EVENT_POWER_CONNECTED
Indicates that the device is connected to an external power supply.
- Value: **usual.event.POWER_CONNECTED**
- Required subscriber permissions: none
## COMMON_EVENT_POWER_DISCONNECTED
Indicates that the device is disconnected from the external power supply.
- Value: **usual.event.POWER_DISCONNECTED**
- Required subscriber permissions: none
## COMMON_EVENT_SCREEN_OFF
Indicates that the device screen is off and the device is in sleep mode.
- Value: **usual.event.SCREEN_OFF**
- Required subscriber permissions: none
## COMMON_EVENT_SCREEN_ON
Indicates that the device screen is on and the device is in interactive state.
- Value: **usual.event.SCREEN_ON**
- Required subscriber permissions: none
## COMMON_EVENT_THERMAL_LEVEL_CHANGED<sup>8+<sup>
Indicates that the device's thermal level has changed.
- Value: **usual.event.THERMAL_LEVEL_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_USER_PRESENT
(Reserved, not supported yet) Indicates that the user unlocks the device.
- Value: **usual.event.USER_PRESENT**
- Required subscriber permissions: none
## COMMON_EVENT_TIME_TICK
Indicates that the system time has changed as time ticks by.
- Value: **usual.event.TIME_TICK**
- Required subscriber permissions: none
## COMMON_EVENT_TIME_CHANGED
Indicates that the system time is set.
- Value: **usual.event.TIME_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_DATE_CHANGED
(Reserved, not supported yet) Indicates that the system date has changed.
- Value: **usual.event.DATE_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_TIMEZONE_CHANGED
Indicates that the system time zone has changed.
- Value: **usual.event.TIMEZONE_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_CLOSE_SYSTEM_DIALOGS
(Reserved, not supported yet) Indicates that the user closes a temporary system dialog box.
- Value: **usual.event.CLOSE_SYSTEM_DIALOGS**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_ADDED
Indicates that a new application package has been installed on the device.
- Value: **usual.event.PACKAGE_ADDED**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_REPLACED
(Reserved, not supported yet) Indicates that a later version of an installed application package has replaced the previous one on the device.
- Value: **usual.event.PACKAGE_REPLACED**
- Required subscriber permissions: none
## COMMON_EVENT_MY_PACKAGE_REPLACED
(Reserved, not supported yet) Indicates that a later version of your application package has replaced the previous one.
- Value: **usual.event.MY_PACKAGE_REPLACED**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_REMOVED
Indicates that an installed application has been uninstalled from the device with the application data retained.
- Value: **usual.event.PACKAGE_REMOVED**
- Required subscriber permissions: none
## COMMON_EVENT_BUNDLE_REMOVED
(Reserved, not supported yet) Indicates that an installed bundle has been uninstalled from the device with the application data retained.
- Value: **usual.event.BUNDLE_REMOVED**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_FULLY_REMOVED
(Reserved, not supported yet) Indicates that an installed application, including both the application data and code, has been completely uninstalled from the device.
- Value: **usual.event.PACKAGE_FULLY_REMOVED**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_CHANGED
Indicates that an application package has been changed (for example, an ability in the package has been enabled or disabled).
- Value: **usual.event.PACKAGE_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_RESTARTED
Indicates that the user closed all processes of the application and restarted the application.
- Value: **usual.event.PACKAGE_RESTARTED**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_DATA_CLEARED
Indicates that the user cleared the application package data.
- Value: **usual.event.PACKAGE_DATA_CLEARED**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_CACHE_CLEARED<sup>9+</sup>
Indicates that the user cleared the application package cache.
- Value: **usual.event.PACKAGE_CACHE_CLEARED**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGES_SUSPENDED
(Reserved, not supported yet) Indicates that application HAP files are suspended.
- Value: **usual.event.PACKAGES_SUSPENDED**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGES_UNSUSPENDED
(Reserved, not supported yet) Indicates that application HAP files are not suspended (restored from the suspended state).
- Value: **usual.event.PACKAGES_UNSUSPENDED**
- Required subscriber permissions: none
## COMMON_EVENT_MY_PACKAGE_SUSPENDED
Indicates that an application HAP file is suspended.
- Value: **usual.event.MY_PACKAGE_SUSPENDED**
- Required subscriber permissions: none
## COMMON_EVENT_MY_PACKAGE_UNSUSPENDED
Indicates that an application HAP file is not suspended.
- Value: **usual.event.MY_PACKAGE_UNSUSPENDED**
- Required subscriber permissions: none
## COMMON_EVENT_UID_REMOVED
(Reserved, not supported yet) Indicates that a user ID has been removed from the system.
- Value: **usual.event.UID_REMOVED**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_FIRST_LAUNCH
(Reserved, not supported yet) Indicates that an installed application is started for the first time.
- Value: **usual.event.PACKAGE_FIRST_LAUNCH**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_NEEDS_VERIFICATION
(Reserved, not supported yet) Indicates that an application requires system verification.
- Value: **usual.event.PACKAGE_NEEDS_VERIFICATION**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_VERIFIED
(Reserved, not supported yet) Indicates that an application has been verified by the system.
- Value: **usual.event.PACKAGE_VERIFIED**
- Required subscriber permissions: none
## COMMON_EVENT_EXTERNAL_APPLICATIONS_AVAILABLE
(Reserved, not supported yet) Indicates that applications installed on the external storage are available for the system.
- Value: **usual.event.EXTERNAL_APPLICATIONS_AVAILABLE**
- Required subscriber permissions: none
## COMMON_EVENT_EXTERNAL_APPLICATIONS_UNAVAILABLE
(Reserved, not supported yet) Indicates that applications installed on the external storage are not available for the system.
- Value: **usual.event.EXTERNAL_APPLICATIONS_UNAVAILABLE**
- Required subscriber permissions: none
## COMMON_EVENT_CONFIGURATION_CHANGED
(Reserved, not supported yet) Indicates that the device state (for example, orientation and locale) has changed.
- Value: **usual.event.CONFIGURATION_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_LOCALE_CHANGED
(Reserved, not supported yet) Indicates that the device locale has changed.
- Value: **usual.event.LOCALE_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_MANAGE_PACKAGE_STORAGE
(Reserved, not supported yet) Indicates that the device storage is insufficient.
- Value: **usual.event.MANAGE_PACKAGE_STORAGE**
- Required subscriber permissions: none
## COMMON_EVENT_DRIVE_MODE
(Reserved, not supported yet) Indicates that the system is in driving mode.
- Value: **common.event.DRIVE_MODE**
- Required subscriber permissions: none
## COMMON_EVENT_HOME_MODE
(Reserved, not supported yet) Indicates that the system is in home mode.
- Value: **common.event.HOME_MODE**
- Required subscriber permissions: none
## COMMON_EVENT_OFFICE_MODE
(Reserved, not supported yet) Indicates that the system is in office mode.
- Value: **common.event.OFFICE_MODE**
- Required subscriber permissions: none
## COMMON_EVENT_USER_STARTED
(Reserved, not supported yet) Indicates that the user has been started.
- Value: **usual.event.USER_STARTED**
- Required subscriber permissions: none
## COMMON_EVENT_USER_BACKGROUND
(Reserved, not supported yet) Indicates that the user has been brought to the background.
- Value: **usual.event.USER_BACKGROUND**
- Required subscriber permissions: none
## COMMON_EVENT_USER_FOREGROUND
(Reserved, not supported yet) Indicates that the user has been brought to the foreground.
- Value: **usual.event.USER_FOREGROUND**
- Required subscriber permissions: none
## COMMON_EVENT_USER_SWITCHED
Indicates that user switching is in progress.
- Value: **usual.event.USER_SWITCHED**
- Required subscriber permissions: ohos.permission.MANAGE_LOCAL_ACCOUNTS
## COMMON_EVENT_USER_STARTING
(Reserved, not supported yet) Indicates that the user is being started.
- Value: **usual.event.USER_STARTING**
- Required subscriber permissions: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
## COMMON_EVENT_USER_UNLOCKED
(Reserved, not supported yet) Indicates that the credential-encrypted storage has been unlocked for the current user after the device is restarted.
- Value: **usual.event.USER_UNLOCKED**
- Required subscriber permissions: none
## COMMON_EVENT_USER_STOPPING
(Reserved, not supported yet) Indicates that the user is going to be stopped.
- Value: **usual.event.USER_STOPPING**
- Required subscriber permissions: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
## COMMON_EVENT_USER_STOPPED
(Reserved, not supported yet) Indicates that the user has been stopped.
- Value: **usual.event.USER_STOPPED**
- Required subscriber permissions: none
## COMMON_EVENT_WIFI_POWER_STATE
Indicates that the Wi-Fi state has changed, for example, enabled or disabled.
- Value: **usual.event.wifi.POWER_STATE**
- Required subscriber permissions: none
## COMMON_EVENT_WIFI_SCAN_FINISHED
Indicates that the Wi-Fi access point has been detected and proven to be available.
- Value: **usual.event.wifi.SCAN_FINISHED**
- Required subscriber permissions: ohos.permission.LOCATION
## COMMON_EVENT_WIFI_RSSI_VALUE
Indicates that the Wi-Fi signal strength (RSSI) has changed.
- Value: **usual.event.wifi.RSSI_VALUE**
- Required subscriber permissions: ohos.permission.GET_WIFI_INFO
## COMMON_EVENT_WIFI_CONN_STATE
Indicates that the Wi-Fi connection state has changed.
- Value: **usual.event.wifi.CONN_STATE**
- Required subscriber permissions: none
## COMMON_EVENT_WIFI_HOTSPOT_STATE
Indicates that the Wi-Fi hotspot state has changed, for example, enabled or disabled.
- Value: **usual.event.wifi.HOTSPOT_STATE**
- Required subscriber permissions: none
## COMMON_EVENT_WIFI_AP_STA_JOIN
Indicates that a client has joined the Wi-Fi hotspot of the current device.
- Value: **usual.event.wifi.WIFI_HS_STA_JOIN**
- Required subscriber permissions: ohos.permission.GET_WIFI_INFO
## COMMON_EVENT_WIFI_AP_STA_LEAVE
Indicates that a client has disconnected from the Wi-Fi hotspot of the current device.
- Value: **usual.event.wifi.WIFI_HS_STA_LEAVE**
- Required subscriber permissions: ohos.permission.GET_WIFI_INFO
## COMMON_EVENT_WIFI_MPLINK_STATE_CHANGE
Indicates that the state of MPLINK (an enhanced Wi-Fi feature) has changed.
- Value: **usual.event.wifi.mplink.STATE_CHANGE**
- Required subscriber permissions: ohos.permission.MPLINK_CHANGE_STATE
## COMMON_EVENT_WIFI_P2P_CONN_STATE
Indicates that the Wi-Fi P2P connection state has changed.
- Value: **usual.event.wifi.p2p.CONN_STATE_CHANGE**
- Required subscriber permissions: ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
## COMMON_EVENT_WIFI_P2P_STATE_CHANGED
Indicates that the Wi-Fi P2P state has changed, for example, enabled or disabled.
- Value: **usual.event.wifi.p2p.STATE_CHANGE**
- Required subscriber permissions: ohos.permission.GET_WIFI_INFO
## COMMON_EVENT_WIFI_P2P_PEERS_STATE_CHANGED
Indicates that the state of the Wi-Fi P2P peer device has changed.
- Value: **usual.event.wifi.p2p.DEVICES_CHANGE**
- Required subscriber permissions: ohos.permission.GET_WIFI_INFO
## COMMON_EVENT_WIFI_P2P_PEERS_DISCOVERY_STATE_CHANGED
Indicates that the Wi-Fi P2P discovery state has changed.
- Value: **usual.event.wifi.p2p.PEER_DISCOVERY_STATE_CHANGE**
- Required subscriber permissions: ohos.permission.GET_WIFI_INFO
## COMMON_EVENT_WIFI_P2P_CURRENT_DEVICE_STATE_CHANGED
Indicates that the state of the Wi-Fi P2P local device has changed.
- Value: **usual.event.wifi.p2p.CURRENT_DEVICE_CHANGE**
- Required subscriber permissions: ohos.permission.GET_WIFI_INFO
## COMMON_EVENT_WIFI_P2P_GROUP_STATE_CHANGED
Indicates that the Wi-Fi P2P group information has changed.
- Value: **usual.event.wifi.p2p.GROUP_STATE_CHANGED**
- Required subscriber permissions: ohos.permission.GET_WIFI_INFO
## COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CONNECT_STATE_UPDATE
(Reserved, not supported yet) Indicates the connection state of Bluetooth handsfree communication.
- Value: **usual.event.bluetooth.handsfree.ag.CONNECT_STATE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CURRENT_DEVICE_UPDATE
(Reserved, not supported yet) Indicates that the device connected through Bluetooth handsfree is active.
- Value: **usual.event.bluetooth.handsfree.ag.CURRENT_DEVICE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_AUDIO_STATE_UPDATE
(Reserved, not supported yet) Indicates that the connection state of Bluetooth A2DP has changed.
- Value: **usual.event.bluetooth.handsfree.ag.AUDIO_STATE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CONNECT_STATE_UPDATE
(Reserved, not supported yet) Indicates the connection state of Bluetooth A2DP.
- Value: **usual.event.bluetooth.a2dpsource.CONNECT_STATE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CURRENT_DEVICE_UPDATE
(Reserved, not supported yet) Indicates that the device connected using Bluetooth A2DP is active.
- Value: **usual.event.bluetooth.a2dpsource.CURRENT_DEVICE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_A2DPSOURCE_PLAYING_STATE_UPDATE
(Reserved, not supported yet) Indicates that the playing state of Bluetooth A2DP has changed.
- Value: **usual.event.bluetooth.a2dpsource.PLAYING_STATE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_A2DPSOURCE_AVRCP_CONNECT_STATE_UPDATE
(Reserved, not supported yet) Indicates that the AVRCP connection state of Bluetooth A2DP has changed.
- Value: **usual.event.bluetooth.a2dpsource.AVRCP_CONNECT_STATE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CODEC_VALUE_UPDATE
(Reserved, not supported yet) Indicates that the audio codec state of Bluetooth A2DP has changed.
- Value: **usual.event.bluetooth.a2dpsource.CODEC_VALUE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_DISCOVERED
(Reserved, not supported yet) Indicates that a remote Bluetooth device is discovered.
- Value: **usual.event.bluetooth.remotedevice.DISCOVERED**
- Required subscriber permissions: ohos.permission.LOCATION and ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CLASS_VALUE_UPDATE
(Reserved, not supported yet) Indicates that the Bluetooth class of a remote Bluetooth device has changed.
- Value: **usual.event.bluetooth.remotedevice.CLASS_VALUE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_CONNECTED
(Reserved, not supported yet) Indicates that a low-ACL connection with a remote Bluetooth device has been established.
- Value: **usual.event.bluetooth.remotedevice.ACL_CONNECTED**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_DISCONNECTED
(Reserved, not supported yet) Indicates that the low-ACL connection with a remote Bluetooth device has been terminated.
- Value: **usual.event.bluetooth.remotedevice.ACL_DISCONNECTED**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_NAME_UPDATE
(Reserved, not supported yet) Indicates that the friendly name of a remote Bluetooth device is retrieved for the first time or has changed since the last retrieval.
- Value: **usual.event.bluetooth.remotedevice.NAME_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIR_STATE
(Reserved, not supported yet) Indicates that the connection state with a remote Bluetooth device has changed.
- Value: **usual.event.bluetooth.remotedevice.PAIR_STATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_BATTERY_VALUE_UPDATE
(Reserved, not supported yet) Indicates that the battery level of a remote Bluetooth device is retrieved for the first time or has changed since the last retrieval.
- Value: **usual.event.bluetooth.remotedevice.BATTERY_VALUE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_SDP_RESULT
(Reserved, not supported yet) Indicates the SDP state of a remote Bluetooth device.
- Value: **usual.event.bluetooth.remotedevice.SDP_RESULT**
- Required subscriber permissions: none
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_UUID_VALUE
(Reserved, not supported yet) Indicates the UUID connection state with a remote Bluetooth device.
- Value: **usual.event.bluetooth.remotedevice.UUID_VALUE**
- Required subscriber permissions: ohos.permission.DISCOVER_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_REQ
(Reserved, not supported yet) Indicates the pairing request from a remote Bluetooth device.
- Value: **usual.event.bluetooth.remotedevice.PAIRING_REQ**
- Required subscriber permissions: ohos.permission.DISCOVER_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_CANCEL
(Reserved, not supported yet) Indicates that Bluetooth pairing has been canceled.
- Value: **usual.event.bluetooth.remotedevice.PAIRING_CANCEL**
- Required subscriber permissions: none
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REQ
(Reserved, not supported yet) Indicates the connection request from a remote Bluetooth device.
- Value: **usual.event.bluetooth.remotedevice.CONNECT_REQ**
- Required subscriber permissions: none
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REPLY
(Reserved, not supported yet) Indicates the response to the connection request from a remote Bluetooth device.
- Value: **usual.event.bluetooth.remotedevice.CONNECT_REPLY**
- Required subscriber permissions: none
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_CANCEL
(Reserved, not supported yet) Indicates that the connection to a remote Bluetooth device has been canceled.
- Value: **usual.event.bluetooth.remotedevice.CONNECT_CANCEL**
- Required subscriber permissions: none
## COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_CONNECT_STATE_UPDATE
(Reserved, not supported yet) Indicates that the connection state with a Bluetooth handsfree has changed.
- Value: **usual.event.bluetooth.handsfreeunit.CONNECT_STATE_UPDATE**
- Required subscriber permissions: none
## COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AUDIO_STATE_UPDATE
(Reserved, not supported yet) Indicates that the audio state of a Bluetooth handsfree has changed.
- Value: **usual.event.bluetooth.handsfreeunit.AUDIO_STATE_UPDATE**
- Required subscriber permissions: none
## COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_COMMON_EVENT
(Reserved, not supported yet) Indicates that the audio gateway state of a Bluetooth handsfree has changed.
- Value: **usual.event.bluetooth.handsfreeunit.AG_COMMON_EVENT**
- Required subscriber permissions: none
## COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_CALL_STATE_UPDATE
(Reserved, not supported yet) Indicates that the calling state of a Bluetooth handsfree has changed.
- Value: **usual.event.bluetooth.handsfreeunit.AG_CALL_STATE_UPDATE**
- Required subscriber permissions: none
## COMMON_EVENT_BLUETOOTH_HOST_STATE_UPDATE
(Reserved, not supported yet) Indicates that the state of a Bluetooth adapter has changed, for example, Bluetooth has been enabled or disabled.
- Value: **usual.event.bluetooth.host.STATE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_HOST_REQ_DISCOVERABLE
(Reserved, not supported yet) Indicates the request for the user to allow Bluetooth device scanning.
- Value: **usual.event.bluetooth.host.REQ_DISCOVERABLE**
- Required subscriber permissions: none
## COMMON_EVENT_BLUETOOTH_HOST_REQ_ENABLE
(Reserved, not supported yet) Indicates the request for the user to enable Bluetooth.
- Value: **usual.event.bluetooth.host.REQ_ENABLE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_HOST_REQ_DISABLE
(Reserved, not supported yet) Indicates the request for the user to disable Bluetooth.
- Value: **usual.event.bluetooth.host.REQ_DISABLE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_HOST_SCAN_MODE_UPDATE
(Reserved, not supported yet) Indicates that the Bluetooth scanning mode of the device has changed.
- Value: **usual.event.bluetooth.host.SCAN_MODE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_STARTED
(Reserved, not supported yet) Indicates that Bluetooth scanning has been started on the device.
- Value: **usual.event.bluetooth.host.DISCOVERY_STARTED**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_FINISHED
(Reserved, not supported yet) Indicates that Bluetooth scanning is finished on the device.
- Value: **usual.event.bluetooth.host.DISCOVERY_FINISHED**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_HOST_NAME_UPDATE
(Reserved, not supported yet) Indicates that the Bluetooth adapter name of the device has changed.
- Value: **usual.event.bluetooth.host.NAME_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_A2DPSINK_CONNECT_STATE_UPDATE
(Reserved, not supported yet) Indicates that the connection state of Bluetooth A2DP Sink has changed.
- Value: **usual.event.bluetooth.a2dpsink.CONNECT_STATE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_A2DPSINK_PLAYING_STATE_UPDATE
(Reserved, not supported yet) Indicates that the playing state of Bluetooth A2DP Sink has changed.
- Value: **usual.event.bluetooth.a2dpsink.PLAYING_STATE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_A2DPSINK_AUDIO_STATE_UPDATE
(Reserved, not supported yet) Indicates that the audio state of Bluetooth A2DP Sink has changed.
- Value: **usual.event.bluetooth.a2dpsink.AUDIO_STATE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_NFC_ACTION_ADAPTER_STATE_CHANGED
(Reserved, not supported yet) Indicates that the state of the device NFC adapter has changed.
- Value: **usual.event.nfc.action.ADAPTER_STATE_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_NFC_ACTION_RF_FIELD_ON_DETECTED
(Reserved, not supported yet) Indicates that the NFC RF field is detected to be in the enabled state.
- Value: **usual.event.nfc.action.RF_FIELD_ON_DETECTED**
- Required subscriber permissions: ohos.permission.MANAGE_SECURE_SETTINGS
## COMMON_EVENT_NFC_ACTION_RF_FIELD_OFF_DETECTED
(Reserved, not supported yet) Indicates that the NFC RF field is detected to be in the disabled state.
- Value: **usual.event.nfc.action.RF_FIELD_OFF_DETECTED**
- Required subscriber permissions: ohos.permission.MANAGE_SECURE_SETTINGS
## COMMON_EVENT_DISCHARGING
Indicates that the system stops charging the battery.
- Value: **usual.event.DISCHARGING**
- Required subscriber permissions: none
## COMMON_EVENT_CHARGING
Indicates that the system starts charging the battery.
- Value: **usual.event.CHARGING**
- Required subscriber permissions: none
## COMMON_EVENT_DEVICE_IDLE_MODE_CHANGED
(Reserved, not supported yet) Indicates that the system idle mode has changed.
- Value: **usual.event.DEVICE_IDLE_MODE_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_POWER_SAVE_MODE_CHANGED
Indicates that the system power saving mode has changed.
- Value: **usual.event.POWER_SAVE_MODE_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_USER_ADDED
Indicates that a user has been added to the system.
- Value: **usual.event.USER_ADDED**
- Required subscriber permissions: ohos.permission.MANAGE_LOCAL_ACCOUNTS
## COMMON_EVENT_USER_REMOVED
Indicates that a user has been removed from the system.
- Value: **usual.event.USER_REMOVED**
- Required subscriber permissions: ohos.permission.MANAGE_LOCAL_ACCOUNTS
## COMMON_EVENT_ABILITY_ADDED
(Reserved, not supported yet) Indicates that an ability has been added.
- Value: **usual.event.ABILITY_ADDED**
- Required subscriber permissions: ohos.permission.LISTEN_BUNDLE_CHANGE
## COMMON_EVENT_ABILITY_REMOVED
(Reserved, not supported yet) Indicates that an ability has been removed.
- Value: **usual.event.ABILITY_REMOVED**
- Required subscriber permissions: ohos.permission.LISTEN_BUNDLE_CHANGE
## COMMON_EVENT_ABILITY_UPDATED
(Reserved, not supported yet) Indicates that an ability has been updated.
- Value: **usual.event.ABILITY_UPDATED**
- Required subscriber permissions: ohos.permission.LISTEN_BUNDLE_CHANGE
## COMMON_EVENT_LOCATION_MODE_STATE_CHANGED
(Reserved, not supported yet) Indicates that the location mode of the system has changed.
- Value: **usual.event.location.MODE_STATE_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_IVI_SLEEP
(Reserved, not supported yet) Indicates that the in-vehicle infotainment (IVI) system is in sleep mode.
- Value: **common.event.IVI_SLEEP**
- Required subscriber permissions: none
## COMMON_EVENT_IVI_PAUSE
(Reserved, not supported yet) Indicates that the IVI system as entered sleep mode and instructs the playing application to stop playback.
- Value: **common.event.IVI_PAUSE**
- Required subscriber permissions: none
## COMMON_EVENT_IVI_STANDBY
(Reserved, not supported yet) Requests a third-party application in the IVI system to pause the current work.
- Value: **common.event.IVI_STANDBY**
- Required subscriber permissions: none
## COMMON_EVENT_IVI_LASTMODE_SAVE
(Reserved, not supported yet) Requests a third-party application in the IVI system to save its last mode.
- Value: **common.event.IVI_LASTMODE_SAVE**
- Required subscriber permissions: none
## COMMON_EVENT_IVI_VOLTAGE_ABNORMAL
(Reserved, not supported yet) Indicates that the voltage of the vehicle's power system is abnormal.
- Value: **common.event.IVI_VOLTAGE_ABNORMAL**
- Required subscriber permissions: none
## COMMON_EVENT_IVI_HIGH_TEMPERATURE
(Reserved, not supported yet) Indicates that the temperature of the IVI system is high.
- Value: **common.event.IVI_HIGH_TEMPERATURE**
- Required subscriber permissions: none
## COMMON_EVENT_IVI_EXTREME_TEMPERATURE
(Reserved, not supported yet) Indicates that the temperature of the IVI system is extremely high.
- Value: **common.event.IVI_EXTREME_TEMPERATURE**
- Required subscriber permissions: none
## COMMON_EVENT_IVI_TEMPERATURE_ABNORMAL
(Reserved, not supported yet) Indicates that the IVI system is at an extreme temperature.
- Value: **common.event.IVI_TEMPERATURE_ABNORMAL**
- Required subscriber permissions: none
## COMMON_EVENT_IVI_VOLTAGE_RECOVERY
(Reserved, not supported yet) Indicates that the voltage of the vehicle's power system is restored to normal.
- Value: **common.event.IVI_VOLTAGE_RECOVERY**
- Required subscriber permissions: none
## COMMON_EVENT_IVI_TEMPERATURE_RECOVERY
(Reserved, not supported yet) Indicates that the temperature of the IVI system is restored to normal.
- Value: **common.event.IVI_TEMPERATURE_RECOVERY**
- Required subscriber permissions: none
## COMMON_EVENT_IVI_ACTIVE
(Reserved, not supported yet) Indicates that the battery service of the IVI system is active.
- Value: **common.event.IVI_ACTIVE**
- Required subscriber permissions: none
## COMMON_EVENT_USB_STATE<sup>9+</sup>
Indicates that the USB device state has changed.
- Value: **usual.event.hardware.usb.action.USB_STATE**
- Required subscriber permissions: none
## COMMON_EVENT_USB_PORT_CHANGED<sup>9+</sup>
Indicates that the USB port state of the device has changed.
- Value: **usual.event.hardware.usb.action.USB_PORT_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_USB_DEVICE_ATTACHED
Indicates that a USB device has been attached to the device functioning as a USB host.
- Value: **usual.event.hardware.usb.action.USB_DEVICE_ATTACHED**
- Required subscriber permissions: none
## COMMON_EVENT_USB_DEVICE_DETACHED
Indicates that a USB device has been detached from the device functioning as a USB host.
- Value: **usual.event.hardware.usb.action.USB_DEVICE_DETACHED**
- Required subscriber permissions: none
## COMMON_EVENT_USB_ACCESSORY_ATTACHED
(Reserved, not supported yet) Indicates that a USB accessory was attached.
- Value: **usual.event.hardware.usb.action.USB_ACCESSORY_ATTACHED**
- Required subscriber permissions: none
## COMMON_EVENT_USB_ACCESSORY_DETACHED
(Reserved, not supported yet) Indicates that a USB accessory was detached.
- Value: **usual.event.hardware.usb.action.USB_ACCESSORY_DETACHED**
- Required subscriber permissions: none
## COMMON_EVENT_DISK_REMOVED
(Reserved, not supported yet) Indicates that an external storage device was removed.
- Value: **usual.event.data.DISK_REMOVED**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_DISK_UNMOUNTED
(Reserved, not supported yet) Indicates that an external storage device was unmounted.
- Value: **usual.event.data.DISK_UNMOUNTED**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_DISK_MOUNTED
(Reserved, not supported yet) Indicates that an external storage device was mounted.
- Value: **usual.event.data.DISK_MOUNTED**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_DISK_BAD_REMOVAL
(Reserved, not supported yet) Indicates that an external storage device was removed without being unmounted.
- Value: usual.event.data.DISK_BAD_REMOVAL
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_DISK_UNMOUNTABLE
(Reserved, not supported yet) Indicates that an external storage device is unmountable when the card is inserted.
- Value: **usual.event.data.DISK_UNMOUNTABLE**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_DISK_EJECT
(Reserved, not supported yet) Indicates that an external storage device was ejected (at the software level).
- Value: **usual.event.data.DISK_EJECT**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_VOLUME_REMOVED<sup>9+<sup>
Indicates that an external storage device was removed.
- Value: **usual.event.data.VOLUME_REMOVED**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_VOLUME_UNMOUNTED<sup>9+<sup>
Indicates that an external storage device was unmounted.
- Value: **usual.event.data.VOLUME_UNMOUNTED**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_VOLUME_MOUNTED<sup>9+<sup>
Indicates that an external storage device was mounted.
- Value: **usual.event.data.VOLUME_MOUNTED**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_VOLUME_BAD_REMOVAL<sup>9+<sup>
Indicates that an external storage device was removed without being unmounted.
- Value: **usual.event.data.VOLUME_BAD_REMOVAL**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_VOLUME_EJECT<sup>9+<sup>
Indicates that an external storage device was ejected (at the software level).
- Value: usual.event.data.VOLUME_EJECT
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_VISIBLE_ACCOUNTS_UPDATED
(Reserved, not supported yet) Indicates that the account visibility changed.
- Value: **usual.event.data.VISIBLE_ACCOUNTS_UPDATED**
- Required subscriber permissions: ohos.permission.GET_APP_ACCOUNTS
## COMMON_EVENT_ACCOUNT_DELETED
(Reserved, not supported yet) Indicates that an account was deleted.
- Value: **usual.event.data.ACCOUNT_DELETED**
- Required subscriber permissions: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
## COMMON_EVENT_FOUNDATION_READY
(Reserved, not supported yet) Indicates that the foundation is ready.
- Value: **usual.event.data.FOUNDATION_READY**
- Required subscriber permissions: ohos.permission.RECEIVER_STARTUP_COMPLETED
## COMMON_EVENT_AIRPLANE_MODE_CHANGED
Indicates that the airplane mode of the device has changed.
- Value: **usual.event.AIRPLANE_MODE**
- Required subscriber permissions: none
## COMMON_EVENT_SPLIT_SCREEN<sup>8+<sup>
Indicates that the screen has been split.
- Value: **usual.event.SPLIT_SCREEN**
- Required subscriber permissions: none
## COMMON_EVENT_SLOT_CHANGE<sup>9+<sup>
Indicates that the notification slot has been updated.
- Value: **usual.event.SLOT_CHANGE**
- Required subscriber permissions: ohos.permission.NOTIFICATION_CONTROLLER
## COMMON_EVENT_SPN_INFO_CHANGED<sup>9+<sup>
Indicates that the SPN displayed has been updated.
- Value: **usual.event.SPN_INFO_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_QUICK_FIX_APPLY_RESULT<sup>9+<sup>
Indicates the result of applying a quick fix to the application.
- Value: **usual.event.QUICK_FIX_APPLY_RESULT**
- Required subscriber permissions: none
# System Common Events
This document provides indexes for system common events defined in OpenHarmony.
For details about the definition of a system common event, see [Support in @ohos.commonEventManager (Common Event)](./js-apis-commonEventManager.md#support).
**System capability**: SystemCapability.Notification.CommonEvent
## COMMON_EVENT_BOOT_COMPLETED
Indicates that the user has finished booting and the system has been loaded.
- Value: **usual.event.BOOT_COMPLETED**
- Required subscriber permissions: ohos.permission.RECEIVER_STARTUP_COMPLETED
## COMMON_EVENT_LOCKED_BOOT_COMPLETED
(Reserved, not supported yet) Indicates that the user has finished booting and the system has been loaded but the screen is still locked.
- Value: **usual.event.LOCKED_BOOT_COMPLETED**
- Required subscriber permissions: ohos.permission.RECEIVER_STARTUP_COMPLETED
## COMMON_EVENT_SHUTDOWN
Indicates that the device is being shut down and the final shutdown will proceed.
- Value: **usual.event.SHUTDOWN**
- Required subscriber permissions: none
## COMMON_EVENT_BATTERY_CHANGED
Indicates that the charging state, level, and other information about the battery have changed.
- Value: **usual.event.BATTERY_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_BATTERY_LOW
Indicates that the battery level is low.
- Value: **usual.event.BATTERY_LOW**
- Required subscriber permissions: none
## COMMON_EVENT_BATTERY_OKAY
Indicates that the battery level is normal.
- Value: **usual.event.BATTERY_OKAY**
- Required subscriber permissions: none
## COMMON_EVENT_POWER_CONNECTED
Indicates that the device is connected to an external power supply.
- Value: **usual.event.POWER_CONNECTED**
- Required subscriber permissions: none
## COMMON_EVENT_POWER_DISCONNECTED
Indicates that the device is disconnected from the external power supply.
- Value: **usual.event.POWER_DISCONNECTED**
- Required subscriber permissions: none
## COMMON_EVENT_SCREEN_OFF
Indicates that the device screen is off and the device is in sleep mode.
- Value: **usual.event.SCREEN_OFF**
- Required subscriber permissions: none
## COMMON_EVENT_SCREEN_ON
Indicates that the device screen is on and the device is in interactive state.
- Value: **usual.event.SCREEN_ON**
- Required subscriber permissions: none
## COMMON_EVENT_THERMAL_LEVEL_CHANGED<sup>8+<sup>
Indicates that the device's thermal level has changed.
- Value: **usual.event.THERMAL_LEVEL_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_USER_PRESENT
(Reserved, not supported yet) Indicates that the user unlocks the device.
- Value: **usual.event.USER_PRESENT**
- Required subscriber permissions: none
## COMMON_EVENT_TIME_TICK
Indicates that the system time has changed as time ticks by.
- Value: **usual.event.TIME_TICK**
- Required subscriber permissions: none
## COMMON_EVENT_TIME_CHANGED
Indicates that the system time is set.
- Value: **usual.event.TIME_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_DATE_CHANGED
(Reserved, not supported yet) Indicates that the system date has changed.
- Value: **usual.event.DATE_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_TIMEZONE_CHANGED
Indicates that the system time zone has changed.
- Value: **usual.event.TIMEZONE_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_CLOSE_SYSTEM_DIALOGS
(Reserved, not supported yet) Indicates that the user closes a temporary system dialog box.
- Value: **usual.event.CLOSE_SYSTEM_DIALOGS**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_ADDED
Indicates that a new application package has been installed on the device.
- Value: **usual.event.PACKAGE_ADDED**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_REPLACED
(Reserved, not supported yet) Indicates that a later version of an installed application package has replaced the previous one on the device.
- Value: **usual.event.PACKAGE_REPLACED**
- Required subscriber permissions: none
## COMMON_EVENT_MY_PACKAGE_REPLACED
(Reserved, not supported yet) Indicates that a later version of your application package has replaced the previous one.
- Value: **usual.event.MY_PACKAGE_REPLACED**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_REMOVED
Indicates that an installed application has been uninstalled from the device with the application data retained.
- Value: **usual.event.PACKAGE_REMOVED**
- Required subscriber permissions: none
## COMMON_EVENT_BUNDLE_REMOVED
(Reserved, not supported yet) Indicates that an installed bundle has been uninstalled from the device with the application data retained.
- Value: **usual.event.BUNDLE_REMOVED**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_FULLY_REMOVED
(Reserved, not supported yet) Indicates that an installed application, including both the application data and code, has been completely uninstalled from the device.
- Value: **usual.event.PACKAGE_FULLY_REMOVED**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_CHANGED
Indicates that an application package has been changed (for example, an ability in the package has been enabled or disabled).
- Value: **usual.event.PACKAGE_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_RESTARTED
Indicates that the user closed all processes of the application and restarted the application.
- Value: **usual.event.PACKAGE_RESTARTED**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_DATA_CLEARED
Indicates that the user cleared the application package data.
- Value: **usual.event.PACKAGE_DATA_CLEARED**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_CACHE_CLEARED<sup>9+</sup>
Indicates that the user cleared the application package cache.
- Value: **usual.event.PACKAGE_CACHE_CLEARED**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGES_SUSPENDED
(Reserved, not supported yet) Indicates that application HAP files are suspended.
- Value: **usual.event.PACKAGES_SUSPENDED**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGES_UNSUSPENDED
(Reserved, not supported yet) Indicates that application HAP files are not suspended (restored from the suspended state).
- Value: **usual.event.PACKAGES_UNSUSPENDED**
- Required subscriber permissions: none
## COMMON_EVENT_MY_PACKAGE_SUSPENDED
Indicates that an application HAP file is suspended.
- Value: **usual.event.MY_PACKAGE_SUSPENDED**
- Required subscriber permissions: none
## COMMON_EVENT_MY_PACKAGE_UNSUSPENDED
Indicates that an application HAP file is not suspended.
- Value: **usual.event.MY_PACKAGE_UNSUSPENDED**
- Required subscriber permissions: none
## COMMON_EVENT_UID_REMOVED
(Reserved, not supported yet) Indicates that a user ID has been removed from the system.
- Value: **usual.event.UID_REMOVED**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_FIRST_LAUNCH
(Reserved, not supported yet) Indicates that an installed application is started for the first time.
- Value: **usual.event.PACKAGE_FIRST_LAUNCH**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_NEEDS_VERIFICATION
(Reserved, not supported yet) Indicates that an application requires system verification.
- Value: **usual.event.PACKAGE_NEEDS_VERIFICATION**
- Required subscriber permissions: none
## COMMON_EVENT_PACKAGE_VERIFIED
(Reserved, not supported yet) Indicates that an application has been verified by the system.
- Value: **usual.event.PACKAGE_VERIFIED**
- Required subscriber permissions: none
## COMMON_EVENT_EXTERNAL_APPLICATIONS_AVAILABLE
(Reserved, not supported yet) Indicates that applications installed on the external storage are available for the system.
- Value: **usual.event.EXTERNAL_APPLICATIONS_AVAILABLE**
- Required subscriber permissions: none
## COMMON_EVENT_EXTERNAL_APPLICATIONS_UNAVAILABLE
(Reserved, not supported yet) Indicates that applications installed on the external storage are not available for the system.
- Value: **usual.event.EXTERNAL_APPLICATIONS_UNAVAILABLE**
- Required subscriber permissions: none
## COMMON_EVENT_CONFIGURATION_CHANGED
(Reserved, not supported yet) Indicates that the device state (for example, orientation and locale) has changed.
- Value: **usual.event.CONFIGURATION_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_LOCALE_CHANGED
(Reserved, not supported yet) Indicates that the device locale has changed.
- Value: **usual.event.LOCALE_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_MANAGE_PACKAGE_STORAGE
(Reserved, not supported yet) Indicates that the device storage is insufficient.
- Value: **usual.event.MANAGE_PACKAGE_STORAGE**
- Required subscriber permissions: none
## COMMON_EVENT_DRIVE_MODE
(Reserved, not supported yet) Indicates that the system is in driving mode.
- Value: **common.event.DRIVE_MODE**
- Required subscriber permissions: none
## COMMON_EVENT_HOME_MODE
(Reserved, not supported yet) Indicates that the system is in home mode.
- Value: **common.event.HOME_MODE**
- Required subscriber permissions: none
## COMMON_EVENT_OFFICE_MODE
(Reserved, not supported yet) Indicates that the system is in office mode.
- Value: **common.event.OFFICE_MODE**
- Required subscriber permissions: none
## COMMON_EVENT_USER_STARTED
(Reserved, not supported yet) Indicates that the user has been started.
- Value: **usual.event.USER_STARTED**
- Required subscriber permissions: none
## COMMON_EVENT_USER_BACKGROUND
(Reserved, not supported yet) Indicates that the user has been brought to the background.
- Value: **usual.event.USER_BACKGROUND**
- Required subscriber permissions: none
## COMMON_EVENT_USER_FOREGROUND
(Reserved, not supported yet) Indicates that the user has been brought to the foreground.
- Value: **usual.event.USER_FOREGROUND**
- Required subscriber permissions: none
## COMMON_EVENT_USER_SWITCHED
Indicates that user switching is in progress.
- Value: **usual.event.USER_SWITCHED**
- Required subscriber permissions: ohos.permission.MANAGE_LOCAL_ACCOUNTS
## COMMON_EVENT_USER_STARTING
(Reserved, not supported yet) Indicates that the user is being started.
- Value: **usual.event.USER_STARTING**
- Required subscriber permissions: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
## COMMON_EVENT_USER_UNLOCKED
(Reserved, not supported yet) Indicates that the credential-encrypted storage has been unlocked for the current user after the device is restarted.
- Value: **usual.event.USER_UNLOCKED**
- Required subscriber permissions: none
## COMMON_EVENT_USER_STOPPING
(Reserved, not supported yet) Indicates that the user is going to be stopped.
- Value: **usual.event.USER_STOPPING**
- Required subscriber permissions: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
## COMMON_EVENT_USER_STOPPED
(Reserved, not supported yet) Indicates that the user has been stopped.
- Value: **usual.event.USER_STOPPED**
- Required subscriber permissions: none
## COMMON_EVENT_DISTRIBUTED_ACCOUNT_LOGIN
(Reserved, not supported yet) Indicates a successful login to a distributed account.
- Value: **usual.event.DISTRIBUTED_ACCOUNT_LOGIN**
- Required subscriber permissions: none
## COMMON_EVENT_DISTRIBUTED_ACCOUNT_LOGOUT
(Reserved, not supported yet) Indicates a successful logout of a distributed account.
- Value: **usual.event.DISTRIBUTED_ACCOUNT_LOGOUT**
- Required subscriber permissions: none
## COMMON_EVENT_DISTRIBUTED_ACCOUNT_TOKEN_INVALID
(Reserved, not supported yet) Indicates the token of a distributed account is invalid.
- Value: **usual.event.DISTRIBUTED_ACCOUNT_TOKEN_INVALID**
- Required subscriber permissions: none
## COMMON_EVENT_DISTRIBUTED_ACCOUNT_LOGOFF
(Reserved, not supported yet) Indicates that a distributed account is deregistered.
- Value: **usual.event.DISTRIBUTED_ACCOUNT_LOGOFF**
- Required subscriber permissions: none
## COMMON_EVENT_WIFI_POWER_STATE
Indicates that the Wi-Fi state has changed, for example, enabled or disabled.
- Value: **usual.event.wifi.POWER_STATE**
- Required subscriber permissions: none
## COMMON_EVENT_WIFI_SCAN_FINISHED
Indicates that the Wi-Fi access point has been detected and proven to be available.
- Value: **usual.event.wifi.SCAN_FINISHED**
- Required subscriber permissions: ohos.permission.LOCATION
## COMMON_EVENT_WIFI_RSSI_VALUE
Indicates that the Wi-Fi signal strength (RSSI) has changed.
- Value: **usual.event.wifi.RSSI_VALUE**
- Required subscriber permissions: ohos.permission.GET_WIFI_INFO
## COMMON_EVENT_WIFI_CONN_STATE
Indicates that the Wi-Fi connection state has changed.
- Value: **usual.event.wifi.CONN_STATE**
- Required subscriber permissions: none
## COMMON_EVENT_WIFI_HOTSPOT_STATE
Indicates that the Wi-Fi hotspot state has changed, for example, enabled or disabled.
- Value: **usual.event.wifi.HOTSPOT_STATE**
- Required subscriber permissions: none
## COMMON_EVENT_WIFI_AP_STA_JOIN
Indicates that a client has joined the Wi-Fi hotspot of the current device.
- Value: **usual.event.wifi.WIFI_HS_STA_JOIN**
- Required subscriber permissions: ohos.permission.GET_WIFI_INFO
## COMMON_EVENT_WIFI_AP_STA_LEAVE
Indicates that a client has disconnected from the Wi-Fi hotspot of the current device.
- Value: **usual.event.wifi.WIFI_HS_STA_LEAVE**
- Required subscriber permissions: ohos.permission.GET_WIFI_INFO
## COMMON_EVENT_WIFI_MPLINK_STATE_CHANGE
Indicates that the state of MPLINK (an enhanced Wi-Fi feature) has changed.
- Value: **usual.event.wifi.mplink.STATE_CHANGE**
- Required subscriber permissions: ohos.permission.MPLINK_CHANGE_STATE
## COMMON_EVENT_WIFI_P2P_CONN_STATE
Indicates that the Wi-Fi P2P connection state has changed.
- Value: **usual.event.wifi.p2p.CONN_STATE_CHANGE**
- Required subscriber permissions: ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
## COMMON_EVENT_WIFI_P2P_STATE_CHANGED
Indicates that the Wi-Fi P2P state has changed, for example, enabled or disabled.
- Value: **usual.event.wifi.p2p.STATE_CHANGE**
- Required subscriber permissions: ohos.permission.GET_WIFI_INFO
## COMMON_EVENT_WIFI_P2P_PEERS_STATE_CHANGED
Indicates that the state of the Wi-Fi P2P peer device has changed.
- Value: **usual.event.wifi.p2p.DEVICES_CHANGE**
- Required subscriber permissions: ohos.permission.GET_WIFI_INFO
## COMMON_EVENT_WIFI_P2P_PEERS_DISCOVERY_STATE_CHANGED
Indicates that the Wi-Fi P2P discovery state has changed.
- Value: **usual.event.wifi.p2p.PEER_DISCOVERY_STATE_CHANGE**
- Required subscriber permissions: ohos.permission.GET_WIFI_INFO
## COMMON_EVENT_WIFI_P2P_CURRENT_DEVICE_STATE_CHANGED
Indicates that the state of the Wi-Fi P2P local device has changed.
- Value: **usual.event.wifi.p2p.CURRENT_DEVICE_CHANGE**
- Required subscriber permissions: ohos.permission.GET_WIFI_INFO
## COMMON_EVENT_WIFI_P2P_GROUP_STATE_CHANGED
Indicates that the Wi-Fi P2P group information has changed.
- Value: **usual.event.wifi.p2p.GROUP_STATE_CHANGED**
- Required subscriber permissions: ohos.permission.GET_WIFI_INFO
## COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CONNECT_STATE_UPDATE
(Reserved, not supported yet) Indicates the connection state of Bluetooth handsfree communication.
- Value: **usual.event.bluetooth.handsfree.ag.CONNECT_STATE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CURRENT_DEVICE_UPDATE
(Reserved, not supported yet) Indicates that the device connected through Bluetooth handsfree is active.
- Value: **usual.event.bluetooth.handsfree.ag.CURRENT_DEVICE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_AUDIO_STATE_UPDATE
(Reserved, not supported yet) Indicates that the connection state of Bluetooth A2DP has changed.
- Value: **usual.event.bluetooth.handsfree.ag.AUDIO_STATE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CONNECT_STATE_UPDATE
(Reserved, not supported yet) Indicates the connection state of Bluetooth A2DP.
- Value: **usual.event.bluetooth.a2dpsource.CONNECT_STATE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CURRENT_DEVICE_UPDATE
(Reserved, not supported yet) Indicates that the device connected using Bluetooth A2DP is active.
- Value: **usual.event.bluetooth.a2dpsource.CURRENT_DEVICE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_A2DPSOURCE_PLAYING_STATE_UPDATE
(Reserved, not supported yet) Indicates that the playing state of Bluetooth A2DP has changed.
- Value: **usual.event.bluetooth.a2dpsource.PLAYING_STATE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_A2DPSOURCE_AVRCP_CONNECT_STATE_UPDATE
(Reserved, not supported yet) Indicates that the AVRCP connection state of Bluetooth A2DP has changed.
- Value: **usual.event.bluetooth.a2dpsource.AVRCP_CONNECT_STATE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CODEC_VALUE_UPDATE
(Reserved, not supported yet) Indicates that the audio codec state of Bluetooth A2DP has changed.
- Value: **usual.event.bluetooth.a2dpsource.CODEC_VALUE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_DISCOVERED
(Reserved, not supported yet) Indicates that a remote Bluetooth device is discovered.
- Value: **usual.event.bluetooth.remotedevice.DISCOVERED**
- Required subscriber permissions: ohos.permission.LOCATION and ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CLASS_VALUE_UPDATE
(Reserved, not supported yet) Indicates that the Bluetooth class of a remote Bluetooth device has changed.
- Value: **usual.event.bluetooth.remotedevice.CLASS_VALUE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_CONNECTED
(Reserved, not supported yet) Indicates that a low-ACL connection with a remote Bluetooth device has been established.
- Value: **usual.event.bluetooth.remotedevice.ACL_CONNECTED**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_DISCONNECTED
(Reserved, not supported yet) Indicates that the low-ACL connection with a remote Bluetooth device has been terminated.
- Value: **usual.event.bluetooth.remotedevice.ACL_DISCONNECTED**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_NAME_UPDATE
(Reserved, not supported yet) Indicates that the friendly name of a remote Bluetooth device is retrieved for the first time or has changed since the last retrieval.
- Value: **usual.event.bluetooth.remotedevice.NAME_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIR_STATE
(Reserved, not supported yet) Indicates that the connection state with a remote Bluetooth device has changed.
- Value: **usual.event.bluetooth.remotedevice.PAIR_STATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_BATTERY_VALUE_UPDATE
(Reserved, not supported yet) Indicates that the battery level of a remote Bluetooth device is retrieved for the first time or has changed since the last retrieval.
- Value: **usual.event.bluetooth.remotedevice.BATTERY_VALUE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_SDP_RESULT
(Reserved, not supported yet) Indicates the SDP state of a remote Bluetooth device.
- Value: **usual.event.bluetooth.remotedevice.SDP_RESULT**
- Required subscriber permissions: none
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_UUID_VALUE
(Reserved, not supported yet) Indicates the UUID connection state with a remote Bluetooth device.
- Value: **usual.event.bluetooth.remotedevice.UUID_VALUE**
- Required subscriber permissions: ohos.permission.DISCOVER_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_REQ
(Reserved, not supported yet) Indicates the pairing request from a remote Bluetooth device.
- Value: **usual.event.bluetooth.remotedevice.PAIRING_REQ**
- Required subscriber permissions: ohos.permission.DISCOVER_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_CANCEL
(Reserved, not supported yet) Indicates that Bluetooth pairing has been canceled.
- Value: **usual.event.bluetooth.remotedevice.PAIRING_CANCEL**
- Required subscriber permissions: none
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REQ
(Reserved, not supported yet) Indicates the connection request from a remote Bluetooth device.
- Value: **usual.event.bluetooth.remotedevice.CONNECT_REQ**
- Required subscriber permissions: none
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REPLY
(Reserved, not supported yet) Indicates the response to the connection request from a remote Bluetooth device.
- Value: **usual.event.bluetooth.remotedevice.CONNECT_REPLY**
- Required subscriber permissions: none
## COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_CANCEL
(Reserved, not supported yet) Indicates that the connection to a remote Bluetooth device has been canceled.
- Value: **usual.event.bluetooth.remotedevice.CONNECT_CANCEL**
- Required subscriber permissions: none
## COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_CONNECT_STATE_UPDATE
(Reserved, not supported yet) Indicates that the connection state with a Bluetooth handsfree has changed.
- Value: **usual.event.bluetooth.handsfreeunit.CONNECT_STATE_UPDATE**
- Required subscriber permissions: none
## COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AUDIO_STATE_UPDATE
(Reserved, not supported yet) Indicates that the audio state of a Bluetooth handsfree has changed.
- Value: **usual.event.bluetooth.handsfreeunit.AUDIO_STATE_UPDATE**
- Required subscriber permissions: none
## COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_COMMON_EVENT
(Reserved, not supported yet) Indicates that the audio gateway state of a Bluetooth handsfree has changed.
- Value: **usual.event.bluetooth.handsfreeunit.AG_COMMON_EVENT**
- Required subscriber permissions: none
## COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_CALL_STATE_UPDATE
(Reserved, not supported yet) Indicates that the calling state of a Bluetooth handsfree has changed.
- Value: **usual.event.bluetooth.handsfreeunit.AG_CALL_STATE_UPDATE**
- Required subscriber permissions: none
## COMMON_EVENT_BLUETOOTH_HOST_STATE_UPDATE
(Reserved, not supported yet) Indicates that the state of a Bluetooth adapter has changed, for example, Bluetooth has been enabled or disabled.
- Value: **usual.event.bluetooth.host.STATE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_HOST_REQ_DISCOVERABLE
(Reserved, not supported yet) Indicates the request for the user to allow Bluetooth device scanning.
- Value: **usual.event.bluetooth.host.REQ_DISCOVERABLE**
- Required subscriber permissions: none
## COMMON_EVENT_BLUETOOTH_HOST_REQ_ENABLE
(Reserved, not supported yet) Indicates the request for the user to enable Bluetooth.
- Value: **usual.event.bluetooth.host.REQ_ENABLE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_HOST_REQ_DISABLE
(Reserved, not supported yet) Indicates the request for the user to disable Bluetooth.
- Value: **usual.event.bluetooth.host.REQ_DISABLE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_HOST_SCAN_MODE_UPDATE
(Reserved, not supported yet) Indicates that the Bluetooth scanning mode of the device has changed.
- Value: **usual.event.bluetooth.host.SCAN_MODE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_STARTED
(Reserved, not supported yet) Indicates that Bluetooth scanning has been started on the device.
- Value: **usual.event.bluetooth.host.DISCOVERY_STARTED**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_FINISHED
(Reserved, not supported yet) Indicates that Bluetooth scanning is finished on the device.
- Value: **usual.event.bluetooth.host.DISCOVERY_FINISHED**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_HOST_NAME_UPDATE
(Reserved, not supported yet) Indicates that the Bluetooth adapter name of the device has changed.
- Value: **usual.event.bluetooth.host.NAME_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_A2DPSINK_CONNECT_STATE_UPDATE
(Reserved, not supported yet) Indicates that the connection state of Bluetooth A2DP Sink has changed.
- Value: **usual.event.bluetooth.a2dpsink.CONNECT_STATE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_A2DPSINK_PLAYING_STATE_UPDATE
(Reserved, not supported yet) Indicates that the playing state of Bluetooth A2DP Sink has changed.
- Value: **usual.event.bluetooth.a2dpsink.PLAYING_STATE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_BLUETOOTH_A2DPSINK_AUDIO_STATE_UPDATE
(Reserved, not supported yet) Indicates that the audio state of Bluetooth A2DP Sink has changed.
- Value: **usual.event.bluetooth.a2dpsink.AUDIO_STATE_UPDATE**
- Required subscriber permissions: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_NFC_ACTION_ADAPTER_STATE_CHANGED
(Reserved, not supported yet) Indicates that the state of the device NFC adapter has changed.
- Value: **usual.event.nfc.action.ADAPTER_STATE_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_NFC_ACTION_RF_FIELD_ON_DETECTED
(Reserved, not supported yet) Indicates that the NFC RF field is detected to be in the enabled state.
- Value: **usual.event.nfc.action.RF_FIELD_ON_DETECTED**
- Required subscriber permissions: ohos.permission.MANAGE_SECURE_SETTINGS
## COMMON_EVENT_NFC_ACTION_RF_FIELD_OFF_DETECTED
(Reserved, not supported yet) Indicates that the NFC RF field is detected to be in the disabled state.
- Value: **usual.event.nfc.action.RF_FIELD_OFF_DETECTED**
- Required subscriber permissions: ohos.permission.MANAGE_SECURE_SETTINGS
## COMMON_EVENT_DISCHARGING
Indicates that the system stops charging the battery.
- Value: **usual.event.DISCHARGING**
- Required subscriber permissions: none
## COMMON_EVENT_CHARGING
Indicates that the system starts charging the battery.
- Value: **usual.event.CHARGING**
- Required subscriber permissions: none
## COMMON_EVENT_DEVICE_IDLE_MODE_CHANGED
(Reserved, not supported yet) Indicates that the system idle mode has changed.
- Value: **usual.event.DEVICE_IDLE_MODE_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_POWER_SAVE_MODE_CHANGED
Indicates that the system power saving mode has changed.
- Value: **usual.event.POWER_SAVE_MODE_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_USER_ADDED
Indicates that a user has been added to the system.
- Value: **usual.event.USER_ADDED**
- Required subscriber permissions: ohos.permission.MANAGE_LOCAL_ACCOUNTS
## COMMON_EVENT_USER_REMOVED
Indicates that a user has been removed from the system.
- Value: **usual.event.USER_REMOVED**
- Required subscriber permissions: ohos.permission.MANAGE_LOCAL_ACCOUNTS
## COMMON_EVENT_ABILITY_ADDED
(Reserved, not supported yet) Indicates that an ability has been added.
- Value: **usual.event.ABILITY_ADDED**
- Required subscriber permissions: ohos.permission.LISTEN_BUNDLE_CHANGE
## COMMON_EVENT_ABILITY_REMOVED
(Reserved, not supported yet) Indicates that an ability has been removed.
- Value: **usual.event.ABILITY_REMOVED**
- Required subscriber permissions: ohos.permission.LISTEN_BUNDLE_CHANGE
## COMMON_EVENT_ABILITY_UPDATED
(Reserved, not supported yet) Indicates that an ability has been updated.
- Value: **usual.event.ABILITY_UPDATED**
- Required subscriber permissions: ohos.permission.LISTEN_BUNDLE_CHANGE
## COMMON_EVENT_LOCATION_MODE_STATE_CHANGED
(Reserved, not supported yet) Indicates that the location mode of the system has changed.
- Value: **usual.event.location.MODE_STATE_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_IVI_SLEEP
(Reserved, not supported yet) Indicates that the in-vehicle infotainment (IVI) system is in sleep mode.
- Value: **common.event.IVI_SLEEP**
- Required subscriber permissions: none
## COMMON_EVENT_IVI_PAUSE
(Reserved, not supported yet) Indicates that the IVI system as entered sleep mode and instructs the playing application to stop playback.
- Value: **common.event.IVI_PAUSE**
- Required subscriber permissions: none
## COMMON_EVENT_IVI_STANDBY
(Reserved, not supported yet) Requests a third-party application in the IVI system to pause the current work.
- Value: **common.event.IVI_STANDBY**
- Required subscriber permissions: none
## COMMON_EVENT_IVI_LASTMODE_SAVE
(Reserved, not supported yet) Requests a third-party application in the IVI system to save its last mode.
- Value: **common.event.IVI_LASTMODE_SAVE**
- Required subscriber permissions: none
## COMMON_EVENT_IVI_VOLTAGE_ABNORMAL
(Reserved, not supported yet) Indicates that the voltage of the vehicle's power system is abnormal.
- Value: **common.event.IVI_VOLTAGE_ABNORMAL**
- Required subscriber permissions: none
## COMMON_EVENT_IVI_HIGH_TEMPERATURE
(Reserved, not supported yet) Indicates that the temperature of the IVI system is high.
- Value: **common.event.IVI_HIGH_TEMPERATURE**
- Required subscriber permissions: none
## COMMON_EVENT_IVI_EXTREME_TEMPERATURE
(Reserved, not supported yet) Indicates that the temperature of the IVI system is extremely high.
- Value: **common.event.IVI_EXTREME_TEMPERATURE**
- Required subscriber permissions: none
## COMMON_EVENT_IVI_TEMPERATURE_ABNORMAL
(Reserved, not supported yet) Indicates that the IVI system is at an extreme temperature.
- Value: **common.event.IVI_TEMPERATURE_ABNORMAL**
- Required subscriber permissions: none
## COMMON_EVENT_IVI_VOLTAGE_RECOVERY
(Reserved, not supported yet) Indicates that the voltage of the vehicle's power system is restored to normal.
- Value: **common.event.IVI_VOLTAGE_RECOVERY**
- Required subscriber permissions: none
## COMMON_EVENT_IVI_TEMPERATURE_RECOVERY
(Reserved, not supported yet) Indicates that the temperature of the IVI system is restored to normal.
- Value: **common.event.IVI_TEMPERATURE_RECOVERY**
- Required subscriber permissions: none
## COMMON_EVENT_IVI_ACTIVE
(Reserved, not supported yet) Indicates that the battery service of the IVI system is active.
- Value: **common.event.IVI_ACTIVE**
- Required subscriber permissions: none
## COMMON_EVENT_USB_STATE<sup>9+</sup>
Indicates that the USB device state has changed.
- Value: **usual.event.hardware.usb.action.USB_STATE**
- Required subscriber permissions: none
## COMMON_EVENT_USB_PORT_CHANGED<sup>9+</sup>
Indicates that the USB port state of the device has changed.
- Value: **usual.event.hardware.usb.action.USB_PORT_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_USB_DEVICE_ATTACHED
Indicates that a USB device has been attached to the device functioning as a USB host.
- Value: **usual.event.hardware.usb.action.USB_DEVICE_ATTACHED**
- Required subscriber permissions: none
## COMMON_EVENT_USB_DEVICE_DETACHED
Indicates that a USB device has been detached from the device functioning as a USB host.
- Value: **usual.event.hardware.usb.action.USB_DEVICE_DETACHED**
- Required subscriber permissions: none
## COMMON_EVENT_USB_ACCESSORY_ATTACHED
(Reserved, not supported yet) Indicates that a USB accessory was attached.
- Value: **usual.event.hardware.usb.action.USB_ACCESSORY_ATTACHED**
- Required subscriber permissions: none
## COMMON_EVENT_USB_ACCESSORY_DETACHED
(Reserved, not supported yet) Indicates that a USB accessory was detached.
- Value: **usual.event.data.DISK_MOUNTED**
- Required subscriber permissions: none
## COMMON_EVENT_DISK_REMOVED
(Reserved, not supported yet) Indicates that an external storage device was removed.
- Value: **usual.event.data.DISK_BAD_REMOVAL**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_DISK_UNMOUNTED
(Reserved, not supported yet) Indicates that an external storage device was unmounted.
- Value: **usual.event.data.DISK_UNMOUNTABLE**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_DISK_MOUNTED
(Reserved, not supported yet) Indicates that an external storage device was mounted.
- Value: **usual.event.hardware.usb.action.USB_ACCESSORY_DETACHED**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_DISK_BAD_REMOVAL
(Reserved, not supported yet) Indicates that an external storage device was removed without being unmounted.
- Value: usual.event.data.DISK_REMOVED
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_DISK_UNMOUNTABLE
(Reserved, not supported yet) Indicates that an external storage device is unmountable when the card is inserted.
- Value: **usual.event.data.DISK_UNMOUNTED**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_DISK_EJECT
(Reserved, not supported yet) Indicates that an external storage device was ejected (at the software level).
- Value: **usual.event.data.DISK_EJECT**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_VOLUME_REMOVED<sup>9+<sup>
Indicates that an external storage device was removed.
- Value: **usual.event.data.VOLUME_REMOVED**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_VOLUME_UNMOUNTED<sup>9+<sup>
Indicates that an external storage device was unmounted.
- Value: **usual.event.data.VOLUME_UNMOUNTED**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_VOLUME_MOUNTED<sup>9+<sup>
Indicates that an external storage device was mounted.
- Value: **usual.event.data.VOLUME_MOUNTED**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_VOLUME_BAD_REMOVAL<sup>9+<sup>
Indicates that an external storage device was removed without being unmounted.
- Value: **usual.event.data.VOLUME_BAD_REMOVAL**
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_VOLUME_EJECT<sup>9+<sup>
Indicates that an external storage device was ejected (at the software level).
- Value: usual.event.data.VOLUME_EJECT
- Required subscriber permissions: ohos.permission.STORAGE_MANAGER
## COMMON_EVENT_VISIBLE_ACCOUNTS_UPDATED
(Reserved, not supported yet) Indicates that the account visibility changed.
- Value: **usual.event.data.VISIBLE_ACCOUNTS_UPDATED**
- Required subscriber permissions: ohos.permission.GET_APP_ACCOUNTS
## COMMON_EVENT_ACCOUNT_DELETED
(Reserved, not supported yet) Indicates that an account was deleted.
- Value: **usual.event.data.ACCOUNT_DELETED**
- Required subscriber permissions: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
## COMMON_EVENT_FOUNDATION_READY
(Reserved, not supported yet) Indicates that the foundation is ready.
- Value: **usual.event.data.FOUNDATION_READY**
- Required subscriber permissions: ohos.permission.RECEIVER_STARTUP_COMPLETED
## COMMON_EVENT_AIRPLANE_MODE_CHANGED
Indicates that the airplane mode of the device has changed.
- Value: **usual.event.AIRPLANE_MODE**
- Required subscriber permissions: none
## COMMON_EVENT_SPLIT_SCREEN
Indicates that the screen has been split.
- Value: **usual.event.SPLIT_SCREEN**
- Required subscriber permissions: ohos.permission.RECEIVER_SPLIT_SCREEN
## COMMON_EVENT_SLOT_CHANGE<sup>9+<sup>
Indicates that the notification slot has been updated.
- Value: **usual.event.SLOT_CHANGE**
- Required subscriber permissions: ohos.permission.NOTIFICATION_CONTROLLER
## COMMON_EVENT_SPN_INFO_CHANGED<sup>9+<sup>
Indicates that the SPN displayed has been updated.
- Value: **usual.event.SPN_INFO_CHANGED**
- Required subscriber permissions: none
## COMMON_EVENT_QUICK_FIX_APPLY_RESULT<sup>9+<sup>
Indicates the result of applying a quick fix to the application.
- Value: **usual.event.QUICK_FIX_APPLY_RESULT**
- Required subscriber permissions: none
# @ohos.commonEvent # @ohos.commonEvent (Common Event)
The **CommonEvent** module provides common event capabilities, including the capabilities to publish, subscribe to, and unsubscribe from common events, as well obtaining and setting the common event result code and result data. The **CommonEvent** module provides common event capabilities, including the capabilities to publish, subscribe to, and unsubscribe from common events, as well obtaining and setting the common event result code and result data.
> **NOTE** > **NOTE**
>
> - The APIs provided by this module are no longer maintained since API version 9. You are advised to use [@ohos.commonEventManager](js-apis-commonEventManager.md). > - The APIs provided by this module are no longer maintained since API version 9. You are advised to use [@ohos.commonEventManager](js-apis-commonEventManager.md).
>
> - 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. > - 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.
## Modules to Import ## Modules to Import
```js ```ts
import CommonEvent from '@ohos.commonEvent'; import CommonEvent from '@ohos.commonEvent';
``` ```
## Support ## Support
The table below lists the event types supported by the **CommonEvent** module. The name and value indicate the macro and name of a common event, respectively. A system common event is an event that is published by a system service or system application and requires specific permissions to subscribe to. To publish or subscribe to this type of event, you must follow the event-specific definitions.
**System capability**: SystemCapability.Notification.CommonEvent
| Name | Value | Subscriber Permission | Description |
| ------------ | ------------------ | ---------------------- | -------------------- |
| COMMON_EVENT_BOOT_COMPLETED | usual.event.BOOT_COMPLETED | ohos.permission.RECEIVER_STARTUP_COMPLETED | Indicates the common event that the user has finished booting and the system has been loaded. |
| COMMON_EVENT_LOCKED_BOOT_COMPLETED | usual.event.LOCKED_BOOT_COMPLETED | ohos.permission.RECEIVER_STARTUP_COMPLETED | Indicates the common event that the user has finished booting and the system has been loaded but the screen is still locked. |
| COMMON_EVENT_SHUTDOWN | usual.event.SHUTDOWN | - | Indicates the common event that the device is being shut down and the final shutdown will proceed. |
| COMMON_EVENT_BATTERY_CHANGED | usual.event.BATTERY_CHANGED | - | Indicates the common event that the charging state, level, and other information about the battery have changed. |
| COMMON_EVENT_BATTERY_LOW | usual.event.BATTERY_LOW | - | Indicates the common event that the battery level is low. |
| COMMON_EVENT_BATTERY_OKAY | usual.event.BATTERY_OKAY | - | Indicates the common event that the battery exits the low state. |
| COMMON_EVENT_POWER_CONNECTED | usual.event.POWER_CONNECTED | - | Indicates the common event that the device is connected to an external power supply. |
| COMMON_EVENT_POWER_DISCONNECTED | usual.event.POWER_DISCONNECTED | - | Indicates the common event that the device is disconnected from the external power supply. |
| COMMON_EVENT_SCREEN_OFF | usual.event.SCREEN_OFF | - | Indicates the common event that the device screen is off and the device is sleeping. |
| COMMON_EVENT_SCREEN_ON | usual.event.SCREEN_ON | - | Indicates the common event that the device screen is on and the device is in interactive state. |
| COMMON_EVENT_THERMAL_LEVEL_CHANGED<sup>8+<sup> | usual.event.THERMAL_LEVEL_CHANGED | - | Indicates the common event that the device's thermal level has changed. |
| COMMON_EVENT_USER_PRESENT | usual.event.USER_PRESENT | - | Indicates the common event that the user unlocks the device. |
| COMMON_EVENT_TIME_TICK | usual.event.TIME_TICK | - | Indicates the common event that the system time has changed. |
| COMMON_EVENT_TIME_CHANGED | usual.event.TIME_CHANGED | - | Indicates the common event that the system time is set. |
| COMMON_EVENT_DATE_CHANGED | usual.event.DATE_CHANGED | - | Indicates the common event that the system time has changed. |
| COMMON_EVENT_TIMEZONE_CHANGED | usual.event.TIMEZONE_CHANGED | - | Indicates the common event that the system time zone has changed. |
| COMMON_EVENT_CLOSE_SYSTEM_DIALOGS | usual.event.CLOSE_SYSTEM_DIALOGS | - | Indicates the common event that a user closes a temporary system dialog box. |
| COMMON_EVENT_PACKAGE_ADDED | usual.event.PACKAGE_ADDED | - | Indicates the common event that a new application package has been installed on the device. |
| COMMON_EVENT_PACKAGE_REPLACED | usual.event.PACKAGE_REPLACED | - | Indicates the common event that a later version of an installed application package has replaced the previous one on the device. |
| COMMON_EVENT_MY_PACKAGE_REPLACED | usual.event.MY_PACKAGE_REPLACED | - | Indicates the common event that a later version of your application package has replaced the previous one.
| COMMON_EVENT_PACKAGE_REMOVED | usual.event.PACKAGE_REMOVED | - | Indicates the common event that an installed application has been uninstalled from the device with the application data retained. |
| COMMON_EVENT_BUNDLE_REMOVED | usual.event.BUNDLE_REMOVED | - | Indicates the common event that an installed bundle has been uninstalled from the device with the application data retained. |
| COMMON_EVENT_PACKAGE_FULLY_REMOVED | usual.event.PACKAGE_FULLY_REMOVED | - | Indicates the common event that an installed application, including both the application data and code, has been completely uninstalled from the device. |
| COMMON_EVENT_PACKAGE_CHANGED | usual.event.PACKAGE_CHANGED | - | Indicates the common event that an application package has been changed (for example, a component in the package has been enabled or disabled). |
| COMMON_EVENT_PACKAGE_RESTARTED | usual.event.PACKAGE_RESTARTED | - | Indicates the common event that the user has restarted the application package and killed all its processes. |
| COMMON_EVENT_PACKAGE_DATA_CLEARED | usual.event.PACKAGE_DATA_CLEARED | - | Indicates the common event that the user has cleared the application package data. |
| COMMON_EVENT_PACKAGE_CACHE_CLEARED<sup>9+</sup> | usual.event.PACKAGE_CACHE_CLEARED | - | Indicates the common event that the user clears the application package cache. |
| COMMON_EVENT_PACKAGES_SUSPENDED | usual.event.PACKAGES_SUSPENDED | - | Indicates the common event that application packages have been suspended. |
| COMMON_EVENT_PACKAGES_UNSUSPENDED | usual.event.PACKAGES_UNSUSPENDED | - | Indicates the common event that application packages have not been suspended. |
| COMMON_EVENT_MY_PACKAGE_SUSPENDED | usual.event.MY_PACKAGE_SUSPENDED | - | Indicates the common event that an application package has been suspended. |
| COMMON_EVENT_MY_PACKAGE_UNSUSPENDED | usual.event.MY_PACKAGE_UNSUSPENDED | - | Indicates the common event that application package has not been suspended. |
| COMMON_EVENT_UID_REMOVED | usual.event.UID_REMOVED | - | Indicates the common event that a user ID has been removed from the system. |
| COMMON_EVENT_PACKAGE_FIRST_LAUNCH | usual.event.PACKAGE_FIRST_LAUNCH | - | Indicates the common event that an installed application is started for the first time. |
| COMMON_EVENT_PACKAGE_NEEDS_VERIFICATION | usual.event.PACKAGE_NEEDS_VERIFICATION | - | Indicates the common event that an application requires system verification. |
| COMMON_EVENT_PACKAGE_VERIFIED | usual.event.PACKAGE_VERIFIED | - | Indicates the common event that an application has been verified by the system. |
| COMMON_EVENT_EXTERNAL_APPLICATIONS_AVAILABLE | usual.event.EXTERNAL_APPLICATIONS_AVAILABLE | - | Indicates the common event that applications installed on the external storage become available for the system. |
| COMMON_EVENT_EXTERNAL_APPLICATIONS_UNAVAILABLE | usual.event.EXTERNAL_APPLICATIONS_UNAVAILABLE | - | Indicates the common event that applications installed on the external storage become unavailable for the system. |
| COMMON_EVENT_CONFIGURATION_CHANGED | usual.event.CONFIGURATION_CHANGED | - | Indicates the common event that the device state (for example, orientation and locale) has changed. |
| COMMON_EVENT_LOCALE_CHANGED | usual.event.LOCALE_CHANGED | - | Indicates the common event that the device locale has changed. |
| COMMON_EVENT_MANAGE_PACKAGE_STORAGE | usual.event.MANAGE_PACKAGE_STORAGE | - | Indicates the common event that the device storage is insufficient. |
| COMMON_EVENT_DRIVE_MODE | common.event.DRIVE_MODE | - | Indicates the common event that the system is in driving mode. |
| COMMON_EVENT_HOME_MODE | common.event.HOME_MODE | - | Indicates the common event that the system is in home mode. |
| COMMON_EVENT_OFFICE_MODE | common.event.OFFICE_MODE | - | Indicates the common event that the system is in office mode. |
| COMMON_EVENT_USER_STARTED | usual.event.USER_STARTED | - | Indicates the common event that the user has been started. |
| COMMON_EVENT_USER_BACKGROUND | usual.event.USER_BACKGROUND | - | Indicates the common event that the user has been brought to the background. |
| COMMON_EVENT_USER_FOREGROUND | usual.event.USER_FOREGROUND | - | Indicates the common event that the user has been brought to the foreground. |
| COMMON_EVENT_USER_SWITCHED | usual.event.USER_SWITCHED | ohos.permission.MANAGE_LOCAL_ACCOUNTS | Indicates the common event that user switching is happening. |
| COMMON_EVENT_USER_STARTING | usual.event.USER_STARTING | ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS | Indicates the common event that the user is going to be started. |
| COMMON_EVENT_USER_UNLOCKED | usual.event.USER_UNLOCKED | - | Indicates the common event that the credential-encrypted storage has been unlocked for the current user when the device is unlocked after being restarted. |
| COMMON_EVENT_USER_STOPPING | usual.event.USER_STOPPING | ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS | Indicates the common event that the user is going to be stopped. |
| COMMON_EVENT_USER_STOPPED | usual.event.USER_STOPPED | - | Indicates the common event that the user has been stopped. |
| COMMON_EVENT_WIFI_POWER_STATE | usual.event.wifi.POWER_STATE | - | Indicates the common event about the Wi-Fi network state, such as enabled and disabled. |
| COMMON_EVENT_WIFI_SCAN_FINISHED | usual.event.wifi.SCAN_FINISHED | ohos.permission.LOCATION | Indicates the common event that the Wi-Fi access point has been scanned and proven to be available. |
| COMMON_EVENT_WIFI_RSSI_VALUE | usual.event.wifi.RSSI_VALUE | ohos.permission.GET_WIFI_INFO | Indicates the common event that the Wi-Fi signal strength (RSSI) has changed. |
| COMMON_EVENT_WIFI_CONN_STATE | usual.event.wifi.CONN_STATE | - | Indicates the common event that the Wi-Fi connection state has changed. |
| COMMON_EVENT_WIFI_HOTSPOT_STATE | usual.event.wifi.HOTSPOT_STATE | - | Indicates the common event about the Wi-Fi hotspot state, such as enabled or disabled. |
| COMMON_EVENT_WIFI_AP_STA_JOIN | usual.event.wifi.WIFI_HS_STA_JOIN | ohos.permission.GET_WIFI_INFO | Indicates the common event that a client has joined the Wi-Fi hotspot of the current device. |
| COMMON_EVENT_WIFI_AP_STA_LEAVE | usual.event.wifi.WIFI_HS_STA_LEAVE | ohos.permission.GET_WIFI_INFO |Indicates the common event that a client has disconnected from the Wi-Fi hotspot of the current device. |
| COMMON_EVENT_WIFI_MPLINK_STATE_CHANGE | usual.event.wifi.mplink.STATE_CHANGE | ohos.permission.MPLINK_CHANGE_STATE | Indicates the common event that the state of MPLINK (an enhanced Wi-Fi feature) has changed. |
| COMMON_EVENT_WIFI_P2P_CONN_STATE | usual.event.wifi.p2p.CONN_STATE_CHANGE | ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION | Indicates the common event that the Wi-Fi P2P connection state has changed. |
| COMMON_EVENT_WIFI_P2P_STATE_CHANGED | usual.event.wifi.p2p.STATE_CHANGE | ohos.permission.GET_WIFI_INFO | Indicates the common event about the Wi-Fi P2P state, such as enabled and disabled. |
| COMMON_EVENT_WIFI_P2P_PEERS_STATE_CHANGED | usual.event.wifi.p2p.DEVICES_CHANGE | ohos.permission.GET_WIFI_INFO | Indicates the common event about the status change of Wi-Fi P2P peer devices. |
| COMMON_EVENT_WIFI_P2P_PEERS_DISCOVERY_STATE_CHANGED | usual.event.wifi.p2p.PEER_DISCOVERY_STATE_CHANGE | ohos.permission.GET_WIFI_INFO | Indicates the common event about the Wi-Fi P2P discovery status change. |
| COMMON_EVENT_WIFI_P2P_CURRENT_DEVICE_STATE_CHANGED | usual.event.wifi.p2p.CURRENT_DEVICE_CHANGE | ohos.permission.GET_WIFI_INFO | Indicates the common event about the status change of the Wi-Fi P2P local device. |
| COMMON_EVENT_WIFI_P2P_GROUP_STATE_CHANGED | usual.event.wifi.p2p.GROUP_STATE_CHANGED | ohos.permission.GET_WIFI_INFO | Indicates the common event that the Wi-Fi P2P group information has changed. |
| COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CONNECT_STATE_UPDATE | usual.event.bluetooth.handsfree.ag.CONNECT_STATE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event about the connection state of Bluetooth handsfree communication. |
| COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CURRENT_DEVICE_UPDATE | usual.event.bluetooth.handsfree.ag.CURRENT_DEVICE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the device connected to the Bluetooth handsfree is active. |
| COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_AUDIO_STATE_UPDATE | usual.event.bluetooth.handsfree.ag.AUDIO_STATE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the connection state of Bluetooth A2DP has changed. |
| COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CONNECT_STATE_UPDATE | usual.event.bluetooth.a2dpsource.CONNECT_STATE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event about the connection state of Bluetooth A2DP. |
| COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CURRENT_DEVICE_UPDATE | usual.event.bluetooth.a2dpsource.CURRENT_DEVICE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the device connected using Bluetooth A2DP is active. |
| COMMON_EVENT_BLUETOOTH_A2DPSOURCE_PLAYING_STATE_UPDATE | usual.event.bluetooth.a2dpsource.PLAYING_STATE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the playing state of Bluetooth A2DP has changed. |
| COMMON_EVENT_BLUETOOTH_A2DPSOURCE_AVRCP_CONNECT_STATE_UPDATE | usual.event.bluetooth.a2dpsource.AVRCP_CONNECT_STATE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the AVRCP connection state of Bluetooth A2DP has changed. |
| COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CODEC_VALUE_UPDATE | usual.event.bluetooth.a2dpsource.CODEC_VALUE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the audio codec state of Bluetooth A2DP has changed. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_DISCOVERED | usual.event.bluetooth.remotedevice.DISCOVERED | ohos.permission.LOCATION and ohos.permission.USE_BLUETOOTH | Indicates the common event that a remote Bluetooth device is discovered. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CLASS_VALUE_UPDATE | usual.event.bluetooth.remotedevice.CLASS_VALUE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the Bluetooth class of a remote Bluetooth device has changed. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_CONNECTED | usual.event.bluetooth.remotedevice.ACL_CONNECTED | ohos.permission.USE_BLUETOOTH | Indicates the common event that a low-ACL connection has been established with a remote Bluetooth device. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_DISCONNECTED | usual.event.bluetooth.remotedevice.ACL_DISCONNECTED | ohos.permission.USE_BLUETOOTH | Indicates the common event that a low-ACL connection has been disconnected from a remote Bluetooth device. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_NAME_UPDATE | usual.event.bluetooth.remotedevice.NAME_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the friendly name of a remote Bluetooth device is retrieved for the first time or is changed since the last retrieval. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIR_STATE | usual.event.bluetooth.remotedevice.PAIR_STATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the connection state of a remote Bluetooth device has changed. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_BATTERY_VALUE_UPDATE | usual.event.bluetooth.remotedevice.BATTERY_VALUE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the battery level of a remote Bluetooth device is retrieved for the first time or is changed since the last retrieval. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_SDP_RESULT | usual.event.bluetooth.remotedevice.SDP_RESULT | - | Indicates the common event about the SDP state of a remote Bluetooth device. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_UUID_VALUE | usual.event.bluetooth.remotedevice.UUID_VALUE | ohos.permission.DISCOVER_BLUETOOTH | Indicates the common event about the UUID connection state of a remote Bluetooth device. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_REQ | usual.event.bluetooth.remotedevice.PAIRING_REQ | ohos.permission.DISCOVER_BLUETOOTH | Indicates the common event about the pairing request from a remote Bluetooth device. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_CANCEL | usual.event.bluetooth.remotedevice.PAIRING_CANCEL | - | Indicates the common event that Bluetooth pairing is canceled. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REQ | usual.event.bluetooth.remotedevice.CONNECT_REQ | - | Indicates the common event about the connection request from a remote Bluetooth device. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REPLY | usual.event.bluetooth.remotedevice.CONNECT_REPLY | - | Indicates the common event about the response to the connection request from a remote Bluetooth device. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_CANCEL | usual.event.bluetooth.remotedevice.CONNECT_CANCEL | - | Indicates the common event that the connection to a remote Bluetooth device has been canceled. |
| COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_CONNECT_STATE_UPDATE | usual.event.bluetooth.handsfreeunit.CONNECT_STATE_UPDATE | - | Indicates the common event that the connection state of a Bluetooth handsfree has changed. |
| COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AUDIO_STATE_UPDATE | usual.event.bluetooth.handsfreeunit.AUDIO_STATE_UPDATE | - | Indicates the common event that the audio state of a Bluetooth handsfree has changed. |
| COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_COMMON_EVENT | usual.event.bluetooth.handsfreeunit.AG_COMMON_EVENT | - | Indicates the common event that the audio gateway state of a Bluetooth handsfree has changed. |
| COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_CALL_STATE_UPDATE | usual.event.bluetooth.handsfreeunit.AG_CALL_STATE_UPDATE | - | Indicates the common event that the calling state of a Bluetooth handsfree has changed. |
| COMMON_EVENT_BLUETOOTH_HOST_STATE_UPDATE | usual.event.bluetooth.host.STATE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the state of a Bluetooth adapter has been changed, for example, Bluetooth has been enabled or disabled. |
| COMMON_EVENT_BLUETOOTH_HOST_REQ_DISCOVERABLE | usual.event.bluetooth.host.REQ_DISCOVERABLE | - | Indicates the common event about the request for the user to allow Bluetooth device scanning. |
| COMMON_EVENT_BLUETOOTH_HOST_REQ_ENABLE | usual.event.bluetooth.host.REQ_ENABLE | ohos.permission.USE_BLUETOOTH | Indicates the common event about the request for the user to enable Bluetooth. |
| COMMON_EVENT_BLUETOOTH_HOST_REQ_DISABLE | usual.event.bluetooth.host.REQ_DISABLE | ohos.permission.USE_BLUETOOTH | Indicates the common event about the request for the user to disable Bluetooth. |
| COMMON_EVENT_BLUETOOTH_HOST_SCAN_MODE_UPDATE | usual.event.bluetooth.host.SCAN_MODE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the Bluetooth scanning mode of a device has changed. |
| COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_STARTED | usual.event.bluetooth.host.DISCOVERY_STARTED | ohos.permission.USE_BLUETOOTH | Indicates the common event that the Bluetooth scanning has been started on the device. |
| COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_FINISHED | usual.event.bluetooth.host.DISCOVERY_FINISHED | ohos.permission.USE_BLUETOOTH | Indicates the common event that the Bluetooth scanning is finished on the device. |
| COMMON_EVENT_BLUETOOTH_HOST_NAME_UPDATE | usual.event.bluetooth.host.NAME_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the Bluetooth adapter name of the device has changed. |
| COMMON_EVENT_BLUETOOTH_A2DPSINK_CONNECT_STATE_UPDATE | usual.event.bluetooth.a2dpsink.CONNECT_STATE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the connection state of Bluetooth A2DP Sink has changed. |
| COMMON_EVENT_BLUETOOTH_A2DPSINK_PLAYING_STATE_UPDATE | usual.event.bluetooth.a2dpsink.PLAYING_STATE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the playing state of Bluetooth A2DP Sink has changed. |
| COMMON_EVENT_BLUETOOTH_A2DPSINK_AUDIO_STATE_UPDATE | usual.event.bluetooth.a2dpsink.AUDIO_STATE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the audio state of Bluetooth A2DP Sink has changed. |
| COMMON_EVENT_NFC_ACTION_ADAPTER_STATE_CHANGED | usual.event.nfc.action.ADAPTER_STATE_CHANGED | - | Indicates the common event that the state of the device's NFC adapter has changed. |
| COMMON_EVENT_NFC_ACTION_RF_FIELD_ON_DETECTED | usual.event.nfc.action.RF_FIELD_ON_DETECTED | ohos.permission.MANAGE_SECURE_SETTINGS | Indicates the common event that the NFC RF field is detected to be in the enabled state. |
| COMMON_EVENT_NFC_ACTION_RF_FIELD_OFF_DETECTED | usual.event.nfc.action.RF_FIELD_OFF_DETECTED | ohos.permission.MANAGE_SECURE_SETTINGS | Indicates the common event that the NFC RF field is detected to be in the disabled state. |
| COMMON_EVENT_DISCHARGING | usual.event.DISCHARGING | - | Indicates the common event that the system stops charging the battery. |
| COMMON_EVENT_CHARGING | usual.event.CHARGING | - | Indicates the common event that the system starts charging the battery. |
| COMMON_EVENT_DEVICE_IDLE_MODE_CHANGED | usual.event.DEVICE_IDLE_MODE_CHANGED | - | Indicates the common event that the system idle mode has changed. |
| COMMON_EVENT_POWER_SAVE_MODE_CHANGED | usual.event.POWER_SAVE_MODE_CHANGED | - | Indicates the common event that the power saving mode of the system has changed. |
| COMMON_EVENT_USER_ADDED | usual.event.USER_ADDED | ohos.permission.MANAGE_LOCAL_ACCOUNTS | Indicates the common event that a user has been added to the system. |
| COMMON_EVENT_USER_REMOVED | usual.event.USER_REMOVED | ohos.permission.MANAGE_LOCAL_ACCOUNTS | Indicates the common event that a user has been removed from the system. |
| COMMON_EVENT_ABILITY_ADDED | usual.event.ABILITY_ADDED | ohos.permission.LISTEN_BUNDLE_CHANGE | Indicates the common event that an ability has been added. |
| COMMON_EVENT_ABILITY_REMOVED | usual.event.ABILITY_REMOVED | ohos.permission.LISTEN_BUNDLE_CHANGE | Indicates the common event that an ability has been removed. |
| COMMON_EVENT_ABILITY_UPDATED | usual.event.ABILITY_UPDATED | ohos.permission.LISTEN_BUNDLE_CHANGE | Indicates the common event that an ability has been updated. |
| COMMON_EVENT_LOCATION_MODE_STATE_CHANGED | usual.event.location.MODE_STATE_CHANGED | - | Indicates the common event that the location mode of the system has changed. |
| COMMON_EVENT_IVI_SLEEP | common.event.IVI_SLEEP | - | Indicates the common event that the in-vehicle infotainment (IVI) system of a vehicle is sleeping. |
| COMMON_EVENT_IVI_PAUSE | common.event.IVI_PAUSE | - | Indicates the common event that the IVI system of a vehicle has entered sleep mode and the playing application is instructed to stop playback. |
| COMMON_EVENT_IVI_STANDBY | common.event.IVI_STANDBY | - | Indicates the common event that a third-party application is instructed to pause the current work. |
| COMMON_EVENT_IVI_LASTMODE_SAVE | common.event.IVI_LASTMODE_SAVE | - | Indicates the common event that a third-party application is instructed to save its last mode. |
| COMMON_EVENT_IVI_VOLTAGE_ABNORMAL | common.event.IVI_VOLTAGE_ABNORMAL | - | Indicates the common event that the voltage of the vehicle's power system is abnormal. |
| COMMON_EVENT_IVI_HIGH_TEMPERATURE | common.event.IVI_HIGH_TEMPERATURE | - | Indicates the common event that the temperature of the IVI system is high. |
| COMMON_EVENT_IVI_EXTREME_TEMPERATURE | common.event.IVI_EXTREME_TEMPERATURE | - | Indicates the common event that the temperature of the IVI system is extremely high. |
| COMMON_EVENT_IVI_TEMPERATURE_ABNORMAL | common.event.IVI_TEMPERATURE_ABNORMAL | - | Indicates the common event that the IVI system has an extreme temperature. |
| COMMON_EVENT_IVI_VOLTAGE_RECOVERY | common.event.IVI_VOLTAGE_RECOVERY | - | Indicates the common event that the voltage of the vehicle's power system is restored to normal. |
| COMMON_EVENT_IVI_TEMPERATURE_RECOVERY | common.event.IVI_TEMPERATURE_RECOVERY | - | Indicates the common event that the temperature of the IVI system is restored to normal. |
| COMMON_EVENT_IVI_ACTIVE | common.event.IVI_ACTIVE | - | Indicates the common event that the battery service is active. |
|COMMON_EVENT_USB_STATE<sup>9+</sup> | usual.event.hardware.usb.action.USB_STATE | - | Indicates the common event that the USB device status has changed. |
|COMMON_EVENT_USB_PORT_CHANGED<sup>9+</sup> | usual.event.hardware.usb.action.USB_PORT_CHANGED | - | Indicates the common event that the USB port status of the user device has changed. |
| COMMON_EVENT_USB_DEVICE_ATTACHED | usual.event.hardware.usb.action.USB_DEVICE_ATTACHED | - | Indicates the common event that a USB device has been attached when the user device functions as a USB host. |
| COMMON_EVENT_USB_DEVICE_DETACHED | usual.event.hardware.usb.action.USB_DEVICE_DETACHED | - | Indicates the common event that a USB device has been detached when the user device functions as a USB host. |
| COMMON_EVENT_USB_ACCESSORY_ATTACHED | usual.event.hardware.usb.action.USB_ACCESSORY_ATTACHED | - | Indicates the common event that a USB accessory was attached. |
| COMMON_EVENT_USB_ACCESSORY_DETACHED | usual.event.hardware.usb.action.USB_ACCESSORY_DETACHED | - | Indicates the common event that a USB accessory was detached. |
| COMMON_EVENT_DISK_REMOVED | usual.event.data.DISK_REMOVED | ohos.permission.STORAGE_MANAGER | Indicates the common event that an external storage device was removed. |
| COMMON_EVENT_DISK_UNMOUNTED | usual.event.data.DISK_UNMOUNTED | ohos.permission.STORAGE_MANAGER | Indicates the common event that an external storage device was unmounted. |
| COMMON_EVENT_DISK_MOUNTED | usual.event.data.DISK_MOUNTED | ohos.permission.STORAGE_MANAGER | Indicates the common event that an external storage device was mounted. |
| COMMON_EVENT_DISK_BAD_REMOVAL | usual.event.data.DISK_BAD_REMOVAL | ohos.permission.STORAGE_MANAGER | Indicates the common event that an external storage device was removed without being unmounted. |
| COMMON_EVENT_DISK_UNMOUNTABLE | usual.event.data.DISK_UNMOUNTABLE | ohos.permission.STORAGE_MANAGER | Indicates the common event that an external storage device becomes unmountable. |
| COMMON_EVENT_DISK_EJECT | usual.event.data.DISK_EJECT | ohos.permission.STORAGE_MANAGER | Indicates the common event that an external storage device was ejected. |
| COMMON_EVENT_VOLUME_REMOVED<sup>9+<sup> | usual.event.data.VOLUME_REMOVED | ohos.permission.STORAGE_MANAGER | Indicates the common event that an external storage device was removed. |
| COMMON_EVENT_VOLUME_UNMOUNTED<sup>9+<sup> | usual.event.data.VOLUME_UNMOUNTED | ohos.permission.STORAGE_MANAGER | Indicates the common event that an external storage device was unmounted. |
| COMMON_EVENT_VOLUME_MOUNTED<sup>9+<sup> | usual.event.data.VOLUME_MOUNTED | ohos.permission.STORAGE_MANAGER | Indicates the common event that an external storage device was mounted. |
| COMMON_EVENT_VOLUME_BAD_REMOVAL<sup>9+<sup> | usual.event.data.VOLUME_BAD_REMOVAL | ohos.permission.STORAGE_MANAGER | Indicates the common event that an external storage device was removed without being unmounted. |
| COMMON_EVENT_VOLUME_EJECT<sup>9+<sup> | usual.event.data.VOLUME_EJECT | ohos.permission.STORAGE_MANAGER | Indicates the common event that an external storage device was ejected. |
| COMMON_EVENT_VISIBLE_ACCOUNTS_UPDATED | usual.event.data.VISIBLE_ACCOUNTS_UPDATED | ohos.permission.GET_APP_ACCOUNTS | Indicates the common event that the account visibility changed. |
| COMMON_EVENT_ACCOUNT_DELETED | usual.event.data.ACCOUNT_DELETED | ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS | Indicates the common event that the account was deleted. |
| COMMON_EVENT_FOUNDATION_READY | usual.event.data.FOUNDATION_READY | ohos.permission.RECEIVER_STARTUP_COMPLETED | Indicates the common event that the foundation is ready. |
| COMMON_EVENT_AIRPLANE_MODE_CHANGED | usual.event.AIRPLANE_MODE | - | Indicates the common event that the airplane mode of the device has changed. |
| COMMON_EVENT_SPLIT_SCREEN<sup>8+<sup> | usual.event.SPLIT_SCREEN | - | Indicates the common event of screen splitting. |
| COMMON_EVENT_SLOT_CHANGE<sup>9+<sup> | usual.event.SLOT_CHANGE | ohos.permission.NOTIFICATION_CONTROLLER | Indicates the common event that the notification slot has been updated. |
| COMMON_EVENT_SPN_INFO_CHANGED <sup>9+<sup> | usual.event.SPN_INFO_CHANGED | - | Indicates the common event that the SPN displayed has been updated. |
| COMMON_EVENT_QUICK_FIX_APPLY_RESULT <sup>9+<sup> | usual.event.QUICK_FIX_APPLY_RESULT | - | Indicates the common event that a quick fix is applied to the application. |
For details about the definitions of all system common events, see [System Common Events](./commonEvent-definitions.md).
## CommonEvent.publish ## CommonEvent.publish
publish(event: string, callback: AsyncCallback\<void>): void ```ts
publish(event: string, callback: AsyncCallback<void>): void
```
Publishes a common event. This API uses an asynchronous callback to return the result. Publishes a common event. This API uses an asynchronous callback to return the result.
...@@ -190,9 +39,9 @@ Publishes a common event. This API uses an asynchronous callback to return the r ...@@ -190,9 +39,9 @@ Publishes a common event. This API uses an asynchronous callback to return the r
**Example** **Example**
```js ```ts
// Callback for common event publication // Callback for common event publication
function publishCallBack(err) { function publishCB(err) {
if (err.code) { if (err.code) {
console.error("publish failed " + JSON.stringify(err)); console.error("publish failed " + JSON.stringify(err));
} else { } else {
...@@ -201,14 +50,14 @@ function publishCallBack(err) { ...@@ -201,14 +50,14 @@ function publishCallBack(err) {
} }
// Publish a common event. // Publish a common event.
CommonEvent.publish("event", publishCallBack); CommonEvent.publish("event", publishCB);
``` ```
## CommonEvent.publish ## CommonEvent.publish
publish(event: string, options: CommonEventPublishData, callback: AsyncCallback\<void>): void ```ts
publish(event: string, options: CommonEventPublishData, callback: AsyncCallback<void>): void
```
Publishes a common event with given attributes. This API uses an asynchronous callback to return the result. Publishes a common event with given attributes. This API uses an asynchronous callback to return the result.
...@@ -225,16 +74,16 @@ Publishes a common event with given attributes. This API uses an asynchronous ca ...@@ -225,16 +74,16 @@ Publishes a common event with given attributes. This API uses an asynchronous ca
**Example** **Example**
```js ```ts
// Attributes of a common event. // Attributes of a common event.
let options = { let options = {
code: 0, // Result code of the common event. code: 0, // Initial code of the common event.
data: "initial data";// Result data of the common event. data: "initial data";// Initial data of the common event.
isOrdered: true // The common event is an ordered one. isOrdered: true // The common event is an ordered one.
} }
// Callback for common event publication // Callback for common event publication
function publishCallBack(err) { function publishCB(err) {
if (err.code) { if (err.code) {
console.error("publish failed " + JSON.stringify(err)); console.error("publish failed " + JSON.stringify(err));
} else { } else {
...@@ -243,14 +92,14 @@ function publishCallBack(err) { ...@@ -243,14 +92,14 @@ function publishCallBack(err) {
} }
// Publish a common event. // Publish a common event.
CommonEvent.publish("event", options, publishCallBack); CommonEvent.publish("event", options, publishCB);
``` ```
## CommonEvent.publishAsUser<sup>8+</sup> ## CommonEvent.publishAsUser<sup>8+</sup>
publishAsUser(event: string, userId: number, callback: AsyncCallback\<void>): void ```ts
publishAsUser(event: string, userId: number, callback: AsyncCallback<void>): void
```
Publishes a common event to a specific user. This API uses an asynchronous callback to return the result. Publishes a common event to a specific user. This API uses an asynchronous callback to return the result.
...@@ -268,9 +117,9 @@ Publishes a common event to a specific user. This API uses an asynchronous callb ...@@ -268,9 +117,9 @@ Publishes a common event to a specific user. This API uses an asynchronous callb
**Example** **Example**
```js ```ts
// Callback for common event publication // Callback for common event publication
function publishAsUserCallBack(err) { function publishCB(err) {
if (err.code) { if (err.code) {
console.error("publishAsUser failed " + JSON.stringify(err)); console.error("publishAsUser failed " + JSON.stringify(err));
} else { } else {
...@@ -282,14 +131,14 @@ function publishAsUserCallBack(err) { ...@@ -282,14 +131,14 @@ function publishAsUserCallBack(err) {
let userId = 100; let userId = 100;
// Publish a common event. // Publish a common event.
CommonEvent.publishAsUser("event", userId, publishAsUserCallBack); CommonEvent.publishAsUser("event", userId, publishCB);
``` ```
## CommonEvent.publishAsUser<sup>8+</sup> ## CommonEvent.publishAsUser<sup>8+</sup>
publishAsUser(event: string, userId: number, options: CommonEventPublishData, callback: AsyncCallback\<void>): void ```ts
publishAsUser(event: string, userId: number, options: CommonEventPublishData, callback: AsyncCallback<void>): void
```
Publishes a common event with given attributes to a specific user. This API uses an asynchronous callback to return the result. Publishes a common event with given attributes to a specific user. This API uses an asynchronous callback to return the result.
...@@ -309,15 +158,15 @@ Publishes a common event with given attributes to a specific user. This API uses ...@@ -309,15 +158,15 @@ Publishes a common event with given attributes to a specific user. This API uses
**Example** **Example**
```js ```ts
// Attributes of a common event. // Attributes of a common event.
let options = { let options = {
code: 0, // Result code of the common event. code: 0, // Initial code of the common event.
data: "initial data";// Result data of the common event. data: "initial data";// Initial data of the common event.
} }
// Callback for common event publication // Callback for common event publication
function publishAsUserCallBack(err) { function publishCB(err) {
if (err.code) { if (err.code) {
console.error("publishAsUser failed " + JSON.stringify(err)); console.error("publishAsUser failed " + JSON.stringify(err));
} else { } else {
...@@ -329,14 +178,14 @@ function publishAsUserCallBack(err) { ...@@ -329,14 +178,14 @@ function publishAsUserCallBack(err) {
let userId = 100; let userId = 100;
// Publish a common event. // Publish a common event.
CommonEvent.publishAsUser("event", userId, options, publishAsUserCallBack); CommonEvent.publishAsUser("event", userId, options, publishCB);
``` ```
## CommonEvent.createSubscriber ## CommonEvent.createSubscriber
createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallback\<CommonEventSubscriber>): void ```ts
createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallback<CommonEventSubscriber>): void
```
Creates a subscriber. This API uses an asynchronous callback to return the result. Creates a subscriber. This API uses an asynchronous callback to return the result.
...@@ -352,7 +201,7 @@ Creates a subscriber. This API uses an asynchronous callback to return the resul ...@@ -352,7 +201,7 @@ Creates a subscriber. This API uses an asynchronous callback to return the resul
**Example** **Example**
```js ```ts
let subscriber; // Used to save the created subscriber object for subsequent subscription and unsubscription. let subscriber; // Used to save the created subscriber object for subsequent subscription and unsubscription.
// Subscriber information. // Subscriber information.
...@@ -361,7 +210,7 @@ let subscribeInfo = { ...@@ -361,7 +210,7 @@ let subscribeInfo = {
}; };
// Callback for subscriber creation. // Callback for subscriber creation.
function createSubscriberCallBack(err, commonEventSubscriber) { function createCB(err, commonEventSubscriber) {
if (err.code) { if (err.code) {
console.error("createSubscriber failed " + JSON.stringify(err)); console.error("createSubscriber failed " + JSON.stringify(err));
} else { } else {
...@@ -371,14 +220,14 @@ function createSubscriberCallBack(err, commonEventSubscriber) { ...@@ -371,14 +220,14 @@ function createSubscriberCallBack(err, commonEventSubscriber) {
} }
// Create a subscriber. // Create a subscriber.
CommonEvent.createSubscriber(subscribeInfo, createSubscriberCallBack); CommonEvent.createSubscriber(subscribeInfo, createCB);
``` ```
## CommonEvent.createSubscriber ## CommonEvent.createSubscriber
createSubscriber(subscribeInfo: CommonEventSubscribeInfo): Promise\<CommonEventSubscriber> ```ts
createSubscriber(subscribeInfo: CommonEventSubscribeInfo): Promise<CommonEventSubscriber>
```
Creates a subscriber. This API uses a promise to return the result. Creates a subscriber. This API uses a promise to return the result.
...@@ -397,7 +246,7 @@ Creates a subscriber. This API uses a promise to return the result. ...@@ -397,7 +246,7 @@ Creates a subscriber. This API uses a promise to return the result.
**Example** **Example**
```js ```ts
let subscriber; // Used to save the created subscriber object for subsequent subscription and unsubscription. let subscriber; // Used to save the created subscriber object for subsequent subscription and unsubscription.
// Subscriber information. // Subscriber information.
...@@ -414,11 +263,11 @@ CommonEvent.createSubscriber(subscribeInfo).then((commonEventSubscriber) => { ...@@ -414,11 +263,11 @@ CommonEvent.createSubscriber(subscribeInfo).then((commonEventSubscriber) => {
}); });
``` ```
## CommonEvent.subscribe ## CommonEvent.subscribe
subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback\<CommonEventData>): void ```ts
subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback<CommonEventData>): void
```
Subscribes to common events. This API uses an asynchronous callback to return the result. Subscribes to common events. This API uses an asynchronous callback to return the result.
...@@ -433,7 +282,7 @@ Subscribes to common events. This API uses an asynchronous callback to return th ...@@ -433,7 +282,7 @@ Subscribes to common events. This API uses an asynchronous callback to return th
**Example** **Example**
```js ```ts
let subscriber; // Used to save the created subscriber object for subsequent subscription and unsubscription. let subscriber; // Used to save the created subscriber object for subsequent subscription and unsubscription.
// Subscriber information. // Subscriber information.
...@@ -442,7 +291,7 @@ let subscribeInfo = { ...@@ -442,7 +291,7 @@ let subscribeInfo = {
}; };
// Callback for common event subscription. // Callback for common event subscription.
function subscribeCallBack(err, data) { function subscribeCB(err, data) {
if (err.code) { if (err.code) {
console.error("subscribe failed " + JSON.stringify(err)); console.error("subscribe failed " + JSON.stringify(err));
} else { } else {
...@@ -451,26 +300,25 @@ function subscribeCallBack(err, data) { ...@@ -451,26 +300,25 @@ function subscribeCallBack(err, data) {
} }
// Callback for subscriber creation. // Callback for subscriber creation.
function createSubscriberCallBack(err, commonEventSubscriber) { function createCB(err, subscriber) {
if (err.code) { if (err.code) {
console.error("createSubscriber failed " + JSON.stringify(err)); console.error("createSubscriber failed " + JSON.stringify(err));
} else { } else {
console.info("createSubscriber"); console.info("createSubscriber");
subscriber = commonEventSubscriber;
// Subscribe to a common event. // Subscribe to a common event.
CommonEvent.subscribe(subscriber, subscribeCallBack); CommonEvent.subscribe(subscriber, subscribeCB);
} }
} }
// Create a subscriber. // Create a subscriber.
CommonEvent.createSubscriber(subscribeInfo, createSubscriberCallBack); CommonEvent.createSubscriber(subscribeInfo, createCB);
``` ```
## CommonEvent.unsubscribe ## CommonEvent.unsubscribe
unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback\<void>): void ```ts
unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback<void>): void
```
Unsubscribes from common events. This API uses an asynchronous callback to return the result. Unsubscribes from common events. This API uses an asynchronous callback to return the result.
...@@ -485,7 +333,7 @@ Unsubscribes from common events. This API uses an asynchronous callback to retur ...@@ -485,7 +333,7 @@ Unsubscribes from common events. This API uses an asynchronous callback to retur
**Example** **Example**
```js ```ts
let subscriber; // Used to save the created subscriber object for subsequent subscription and unsubscription. let subscriber; // Used to save the created subscriber object for subsequent subscription and unsubscription.
// Subscriber information. // Subscriber information.
...@@ -494,7 +342,7 @@ let subscribeInfo = { ...@@ -494,7 +342,7 @@ let subscribeInfo = {
}; };
// Callback for common event subscription. // Callback for common event subscription.
function subscribeCallBack(err, data) { function subscribeCB(err, data) {
if (err.code) { if (err.code) {
console.info("subscribe failed " + JSON.stringify(err)); console.info("subscribe failed " + JSON.stringify(err));
} else { } else {
...@@ -503,19 +351,19 @@ function subscribeCallBack(err, data) { ...@@ -503,19 +351,19 @@ function subscribeCallBack(err, data) {
} }
// Callback for subscriber creation. // Callback for subscriber creation.
function createSubscriberCallBack(err, commonEventSubscriber) { function createCB(err, commonEventSubscriber) {
if (err.code) { if (err.code) {
console.info("createSubscriber failed " + JSON.stringify(err)); console.info("createSubscriber failed " + JSON.stringify(err));
} else { } else {
console.info("createSubscriber"); console.info("createSubscriber");
subscriber = commonEventSubscriber; subscriber = commonEventSubscriber;
// Subscribe to a common event. // Subscribe to a common event.
CommonEvent.subscribe(subscriber, subscribeCallBack); CommonEvent.subscribe(subscriber, subscribeCB);
} }
} }
// Callback for common event unsubscription. // Callback for common event unsubscription.
function unsubscribeCallBack(err) { function unsubscribeCB(err) {
if (err.code) { if (err.code) {
console.info("unsubscribe failed " + JSON.stringify(err)); console.info("unsubscribe failed " + JSON.stringify(err));
} else { } else {
...@@ -524,19 +372,21 @@ function unsubscribeCallBack(err) { ...@@ -524,19 +372,21 @@ function unsubscribeCallBack(err) {
} }
// Create a subscriber. // Create a subscriber.
CommonEvent.createSubscriber(subscribeInfo, createSubscriberCallBack); CommonEvent.createSubscriber(subscribeInfo, createCB);
// Unsubscribe from the common event. // Unsubscribe from the common event.
CommonEvent.unsubscribe(subscriber, unsubscribeCallBack); CommonEvent.unsubscribe(subscriber, unsubscribeCB);
``` ```
## CommonEventSubscriber ## CommonEventSubscriber
### getCode ### getCode
getCode(callback: AsyncCallback\<number>): void ```ts
getCode(callback: AsyncCallback<number>): void
```
Obtains the result code of this common event. This API uses an asynchronous callback to return the result. Obtains the code of this common event. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -544,29 +394,31 @@ Obtains the result code of this common event. This API uses an asynchronous call ...@@ -544,29 +394,31 @@ Obtains the result code of this common event. This API uses an asynchronous call
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------ | | -------- | ---------------------- | ---- | ------------------ |
| callback | AsyncCallback\<number> | Yes | Callback used to return the result code.| | callback | AsyncCallback\<number> | Yes | Common event code.|
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for result code obtaining of an ordered common event. // Callback for result code obtaining of an ordered common event.
function getCodeCallback(err, Code) { function getCodeCB(err, Code) {
if (err.code) { if (err.code) {
console.error("getCode failed " + JSON.stringify(err)); console.error("getCode failed " + JSON.stringify(err));
} else { } else {
console.info("getCode " + JSON.stringify(Code)); console.info("getCode " + JSON.stringify(Code));
} }
} }
subscriber.getCode(getCodeCallback); subscriber.getCode(getCodeCB);
``` ```
### getCode ### getCode
getCode(): Promise\<number> ```ts
getCode(): Promise<number>
```
Obtains the result code of this common event. This API uses a promise to return the result. Obtains the code of this common event. This API uses a promise to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -574,15 +426,15 @@ Obtains the result code of this common event. This API uses a promise to return ...@@ -574,15 +426,15 @@ Obtains the result code of this common event. This API uses a promise to return
| Type | Description | | Type | Description |
| ---------------- | -------------------- | | ---------------- | -------------------- |
| Promise\<number> | Promise used to return the result.| | Promise\<number> | Common event code.|
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.getCode().then((Code) => { subscriber.getCode().then((code) => {
console.info("getCode " + JSON.stringify(Code)); console.info("getCode " + JSON.stringify(code));
}).catch((err) => { }).catch((err) => {
console.error("getCode failed " + JSON.stringify(err)); console.error("getCode failed " + JSON.stringify(err));
}); });
...@@ -590,9 +442,11 @@ subscriber.getCode().then((Code) => { ...@@ -590,9 +442,11 @@ subscriber.getCode().then((Code) => {
### setCode ### setCode
setCode(code: number, callback: AsyncCallback\<void>): void ```ts
setCode(code: number, callback: AsyncCallback<void>): void
```
Sets the result code for this common event. This API uses an asynchronous callback to return the result. Sets the code for this common event. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -600,30 +454,32 @@ Sets the result code for this common event. This API uses an asynchronous callba ...@@ -600,30 +454,32 @@ Sets the result code for this common event. This API uses an asynchronous callba
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ---------------------- | | -------- | -------------------- | ---- | ---------------------- |
| code | number | Yes | Result code of the common event. | | code | number | Yes | Common event code. |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result.| | callback | AsyncCallback\<void> | Yes | Callback used to return the result.|
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for result code setting of an ordered common event. // Callback for result code setting of an ordered common event.
function setCodeCallback(err) { function setCodeCB(err) {
if (err.code) { if (err.code) {
console.error("setCode failed " + JSON.stringify(err)); console.error("setCode failed " + JSON.stringify(err));
} else { } else {
console.info("setCode"); console.info("setCode");
} }
} }
subscriber.setCode(1, setCodeCallback); subscriber.setCode(1, setCodeCB);
``` ```
### setCode ### setCode
setCode(code: number): Promise\<void> ```ts
setCode(code: number): Promise<void>
```
Sets the result code for this common event. This API uses a promise to return the result. Sets the code for this common event. This API uses a promise to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -631,7 +487,7 @@ Sets the result code for this common event. This API uses a promise to return th ...@@ -631,7 +487,7 @@ Sets the result code for this common event. This API uses a promise to return th
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------ | | ------ | ------ | ---- | ------------------ |
| code | number | Yes | Result code of the common event.| | code | number | Yes | Common event code.|
**Return value** **Return value**
...@@ -641,7 +497,7 @@ Sets the result code for this common event. This API uses a promise to return th ...@@ -641,7 +497,7 @@ Sets the result code for this common event. This API uses a promise to return th
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.setCode(1).then(() => { subscriber.setCode(1).then(() => {
...@@ -653,9 +509,11 @@ subscriber.setCode(1).then(() => { ...@@ -653,9 +509,11 @@ subscriber.setCode(1).then(() => {
### getData ### getData
getData(callback: AsyncCallback\<string>): void ```ts
getData(callback: AsyncCallback<string>): void
```
Obtains the result data of this common event. This API uses an asynchronous callback to return the result. Obtains the data of this common event. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -663,29 +521,32 @@ Obtains the result data of this common event. This API uses an asynchronous call ...@@ -663,29 +521,32 @@ Obtains the result data of this common event. This API uses an asynchronous call
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------------------- | | -------- | ---------------------- | ---- | -------------------- |
| callback | AsyncCallback\<string> | Yes | Result data of the common event.| | callback | AsyncCallback\<string> | Yes | Common event data.|
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for result data obtaining of an ordered common event. // Callback for result data obtaining of an ordered common event.
function getDataCallback(err, Data) { function getDataCB(err, data) {
if (err.code) { if (err.code) {
console.error("getData failed " + JSON.stringify(err)); console.error("getData failed " + JSON.stringify(err));
} else { } else {
console.info("getData " + JSON.stringify(Data)); console.info("getData " + JSON.stringify(data));
} }
} }
subscriber.getData(getDataCallback);
subscriber.getData(getDataCB);
``` ```
### getData ### getData
getData(): Promise\<string> ```ts
getData(): Promise<string>
```
Obtains the result data of this common event. This API uses a promise to return the result. Obtains the data of this common event. This API uses a promise to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -693,15 +554,15 @@ Obtains the result data of this common event. This API uses a promise to return ...@@ -693,15 +554,15 @@ Obtains the result data of this common event. This API uses a promise to return
| Type | Description | | Type | Description |
| ---------------- | ------------------ | | ---------------- | ------------------ |
| Promise\<string> | Result data of the common event.| | Promise\<string> | Common event data.|
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.getData().then((Data) => { subscriber.getData().then((data) => {
console.info("getData " + JSON.stringify(Data)); console.info("getData " + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
console.error("getData failed " + JSON.stringify(err)); console.error("getData failed " + JSON.stringify(err));
}); });
...@@ -709,9 +570,11 @@ subscriber.getData().then((Data) => { ...@@ -709,9 +570,11 @@ subscriber.getData().then((Data) => {
### setData ### setData
setData(data: string, callback: AsyncCallback\<void>): void ```ts
setData(data: string, callback: AsyncCallback<void>): void
```
Sets the result data for this common event. This API uses an asynchronous callback to return the result. Sets the data for this common event. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -719,30 +582,32 @@ Sets the result data for this common event. This API uses an asynchronous callba ...@@ -719,30 +582,32 @@ Sets the result data for this common event. This API uses an asynchronous callba
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | -------------------- | | -------- | -------------------- | ---- | -------------------- |
| data | string | Yes | Result data of the common event. | | data | string | Yes | Common event data. |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result.| | callback | AsyncCallback\<void> | Yes | Callback used to return the result.|
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for result data setting of an ordered common event // Callback for result data setting of an ordered common event
function setDataCallback(err) { function setDataCB(err) {
if (err.code) { if (err.code) {
console.error("setData failed " + JSON.stringify(err)); console.error("setData failed " + JSON.stringify(err));
} else { } else {
console.info("setData"); console.info("setData");
} }
} }
subscriber.setData("publish_data_changed", setDataCallback); subscriber.setData("publish_data_changed", setDataCB);
``` ```
### setData ### setData
setData(data: string): Promise\<void> ```ts
setData(data: string): Promise<void>
```
Sets the result data for this common event. This API uses a promise to return the result. Sets the data for this common event. This API uses a promise to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -750,7 +615,7 @@ Sets the result data for this common event. This API uses a promise to return th ...@@ -750,7 +615,7 @@ Sets the result data for this common event. This API uses a promise to return th
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------- | | ------ | ------ | ---- | -------------------- |
| data | string | Yes | Result data of the common event.| | data | string | Yes | Common event data.|
**Return value** **Return value**
...@@ -760,7 +625,7 @@ Sets the result data for this common event. This API uses a promise to return th ...@@ -760,7 +625,7 @@ Sets the result data for this common event. This API uses a promise to return th
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.setData("publish_data_changed").then(() => { subscriber.setData("publish_data_changed").then(() => {
...@@ -772,9 +637,11 @@ subscriber.setData("publish_data_changed").then(() => { ...@@ -772,9 +637,11 @@ subscriber.setData("publish_data_changed").then(() => {
### setCodeAndData ### setCodeAndData
setCodeAndData(code: number, data: string, callback:AsyncCallback\<void>): void ```ts
setCodeAndData(code: number, data: string, callback:AsyncCallback<void>): void
```
Sets the result code and result data for this common event. This API uses an asynchronous callback to return the result. Sets the code and data for this common event. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -782,31 +649,34 @@ Sets the result code and result data for this common event. This API uses an asy ...@@ -782,31 +649,34 @@ Sets the result code and result data for this common event. This API uses an asy
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ---------------------- | | -------- | -------------------- | ---- | ---------------------- |
| code | number | Yes | Result code of the common event. | | code | number | Yes | Common event code. |
| data | string | Yes | Result data of the common event. | | data | string | Yes | Common event data. |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result.| | callback | AsyncCallback\<void> | Yes | Callback used to return the result.|
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for result code and result data setting of an ordered common event. // Callback for result code and result data setting of an ordered common event.
function setCodeDataCallback(err) { function setCodeDataCB(err) {
if (err.code) { if (err.code) {
console.error("setCodeAndData failed " + JSON.stringify(err)); console.error("setCodeAndData failed " + JSON.stringify(err));
} else { } else {
console.info("setCodeDataCallback"); console.info("setCodeDataCallback");
} }
} }
subscriber.setCodeAndData(1, "publish_data_changed", setCodeDataCallback);
subscriber.setCodeAndData(1, "publish_data_changed", setCodeDataCB);
``` ```
### setCodeAndData ### setCodeAndData
setCodeAndData(code: number, data: string): Promise\<void> ```ts
setCodeAndData(code: number, data: string): Promise<void>
```
Sets the result code and result data for this common event. This API uses a promise to return the result. Sets the code and data for this common event. This API uses a promise to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -814,8 +684,8 @@ Sets the result code and result data for this common event. This API uses a prom ...@@ -814,8 +684,8 @@ Sets the result code and result data for this common event. This API uses a prom
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------- | | ------ | ------ | ---- | -------------------- |
| code | number | Yes | Result code of the common event.| | code | number | Yes | Common event code.|
| data | string | Yes | Result data of the common event.| | data | string | Yes | Common event data.|
**Return value** **Return value**
...@@ -825,7 +695,7 @@ Sets the result code and result data for this common event. This API uses a prom ...@@ -825,7 +695,7 @@ Sets the result code and result data for this common event. This API uses a prom
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.setCodeAndData(1, "publish_data_changed").then(() => { subscriber.setCodeAndData(1, "publish_data_changed").then(() => {
...@@ -837,11 +707,12 @@ subscriber.setCodeAndData(1, "publish_data_changed").then(() => { ...@@ -837,11 +707,12 @@ subscriber.setCodeAndData(1, "publish_data_changed").then(() => {
### isOrderedCommonEvent ### isOrderedCommonEvent
isOrderedCommonEvent(callback: AsyncCallback\<boolean>): void ```ts
isOrderedCommonEvent(callback: AsyncCallback<boolean>): void
```
Checks whether this common event is an ordered one. This API uses an asynchronous callback to return the result. Checks whether this common event is an ordered one. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
**Parameters** **Parameters**
...@@ -852,27 +723,28 @@ Checks whether this common event is an ordered one. This API uses an asynchronou ...@@ -852,27 +723,28 @@ Checks whether this common event is an ordered one. This API uses an asynchronou
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for checking whether the current common event is an ordered one. // Callback for checking whether the current common event is an ordered one.
function isOrderedCallback(err, isOrdered) { function isOrderedCB(err, isOrdered) {
if (err.code) { if (err.code) {
console.error("isOrderedCommonEvent failed " + JSON.stringify(err)); console.error("isOrderedCommonEvent failed " + JSON.stringify(err));
} else { } else {
console.info("isOrdered " + JSON.stringify(isOrdered)); console.info("isOrdered " + JSON.stringify(isOrdered));
} }
} }
subscriber.isOrderedCommonEvent(isOrderedCallback); subscriber.isOrderedCommonEvent(isOrderedCB);
``` ```
### isOrderedCommonEvent ### isOrderedCommonEvent
isOrderedCommonEvent(): Promise\<boolean> ```ts
isOrderedCommonEvent(): Promise<boolean>
```
Checks whether this common event is an ordered one. This API uses a promise to return the result. Checks whether this common event is an ordered one. This API uses a promise to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
**Return value** **Return value**
...@@ -883,7 +755,7 @@ Checks whether this common event is an ordered one. This API uses a promise to r ...@@ -883,7 +755,7 @@ Checks whether this common event is an ordered one. This API uses a promise to r
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.isOrderedCommonEvent().then((isOrdered) => { subscriber.isOrderedCommonEvent().then((isOrdered) => {
...@@ -895,11 +767,12 @@ subscriber.isOrderedCommonEvent().then((isOrdered) => { ...@@ -895,11 +767,12 @@ subscriber.isOrderedCommonEvent().then((isOrdered) => {
### isStickyCommonEvent ### isStickyCommonEvent
isStickyCommonEvent(callback: AsyncCallback\<boolean>): void ```ts
isStickyCommonEvent(callback: AsyncCallback<boolean>): void
```
Checks whether this common event is a sticky one. This API uses an asynchronous callback to return the result. Checks whether this common event is a sticky one. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
**Parameters** **Parameters**
...@@ -910,27 +783,28 @@ Checks whether this common event is a sticky one. This API uses an asynchronous ...@@ -910,27 +783,28 @@ Checks whether this common event is a sticky one. This API uses an asynchronous
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for checking whether the current common event is a sticky one. // Callback for checking whether the current common event is a sticky one.
function isStickyCallback(err, isSticky) { function isStickyCB(err, isSticky) {
if (err.code) { if (err.code) {
console.error("isStickyCommonEvent failed " + JSON.stringify(err)); console.error("isStickyCommonEvent failed " + JSON.stringify(err));
} else { } else {
console.info("isSticky " + JSON.stringify(isSticky)); console.info("isSticky " + JSON.stringify(isSticky));
} }
} }
subscriber.isStickyCommonEvent(isStickyCallback); subscriber.isStickyCommonEvent(isStickyCB);
``` ```
### isStickyCommonEvent ### isStickyCommonEvent
isStickyCommonEvent(): Promise\<boolean> ```ts
isStickyCommonEvent(): Promise<boolean>
```
Checks whether this common event is a sticky one. This API uses a promise to return the result. Checks whether this common event is a sticky one. This API uses a promise to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
**Return value** **Return value**
...@@ -941,7 +815,7 @@ Checks whether this common event is a sticky one. This API uses a promise to ret ...@@ -941,7 +815,7 @@ Checks whether this common event is a sticky one. This API uses a promise to ret
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.isStickyCommonEvent().then((isSticky) => { subscriber.isStickyCommonEvent().then((isSticky) => {
...@@ -953,7 +827,9 @@ subscriber.isStickyCommonEvent().then((isSticky) => { ...@@ -953,7 +827,9 @@ subscriber.isStickyCommonEvent().then((isSticky) => {
### abortCommonEvent ### abortCommonEvent
abortCommonEvent(callback: AsyncCallback\<void>): void ```ts
abortCommonEvent(callback: AsyncCallback<void>): void
```
Aborts this common event. After the abort, the common event is not sent to the next subscriber. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result. Aborts this common event. After the abort, the common event is not sent to the next subscriber. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result.
...@@ -967,23 +843,26 @@ Aborts this common event. After the abort, the common event is not sent to the n ...@@ -967,23 +843,26 @@ Aborts this common event. After the abort, the common event is not sent to the n
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for common event aborting. // Callback for common event aborting.
function abortCallback(err) { function abortCB(err) {
if (err.code) { if (err.code) {
console.error("abortCommonEvent failed " + JSON.stringify(err)); console.error("abortCommonEvent failed " + JSON.stringify(err));
} else { } else {
console.info("abortCommonEvent"); console.info("abortCommonEvent");
} }
} }
subscriber.abortCommonEvent(abortCallback);
subscriber.abortCommonEvent(abortCB);
``` ```
### abortCommonEvent ### abortCommonEvent
abortCommonEvent(): Promise\<void> ```ts
abortCommonEvent(): Promise<void>
```
Aborts this common event. After the abort, the common event is not sent to the next subscriber. This API takes effect only for ordered common events. It uses a promise to return the result. Aborts this common event. After the abort, the common event is not sent to the next subscriber. This API takes effect only for ordered common events. It uses a promise to return the result.
...@@ -997,7 +876,7 @@ Aborts this common event. After the abort, the common event is not sent to the n ...@@ -997,7 +876,7 @@ Aborts this common event. After the abort, the common event is not sent to the n
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.abortCommonEvent().then(() => { subscriber.abortCommonEvent().then(() => {
...@@ -1009,7 +888,9 @@ subscriber.abortCommonEvent().then(() => { ...@@ -1009,7 +888,9 @@ subscriber.abortCommonEvent().then(() => {
### clearAbortCommonEvent ### clearAbortCommonEvent
clearAbortCommonEvent(callback: AsyncCallback\<void>): void ```ts
clearAbortCommonEvent(callback: AsyncCallback<void>): void
```
Clears the aborted state of this common event. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result. Clears the aborted state of this common event. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result.
...@@ -1023,23 +904,26 @@ Clears the aborted state of this common event. This API takes effect only for or ...@@ -1023,23 +904,26 @@ Clears the aborted state of this common event. This API takes effect only for or
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for clearing the aborted state of the current common event. // Callback for clearing the aborted state of the current common event.
function clearAbortCallback(err) { function clearAbortCB(err) {
if (err.code) { if (err.code) {
console.error("clearAbortCommonEvent failed " + JSON.stringify(err)); console.error("clearAbortCommonEvent failed " + JSON.stringify(err));
} else { } else {
console.info("clearAbortCommonEvent"); console.info("clearAbortCommonEvent");
} }
} }
subscriber.clearAbortCommonEvent(clearAbortCallback);
subscriber.clearAbortCommonEvent(clearAbortCB);
``` ```
### clearAbortCommonEvent ### clearAbortCommonEvent
clearAbortCommonEvent(): Promise\<void> ```ts
clearAbortCommonEvent(): Promise<void>
```
Clears the aborted state of this common event. This API takes effect only for ordered common events. It uses a promise to return the result. Clears the aborted state of this common event. This API takes effect only for ordered common events. It uses a promise to return the result.
...@@ -1053,7 +937,7 @@ Clears the aborted state of this common event. This API takes effect only for or ...@@ -1053,7 +937,7 @@ Clears the aborted state of this common event. This API takes effect only for or
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.clearAbortCommonEvent().then(() => { subscriber.clearAbortCommonEvent().then(() => {
...@@ -1065,7 +949,9 @@ subscriber.clearAbortCommonEvent().then(() => { ...@@ -1065,7 +949,9 @@ subscriber.clearAbortCommonEvent().then(() => {
### getAbortCommonEvent ### getAbortCommonEvent
getAbortCommonEvent(callback: AsyncCallback\<boolean>): void ```ts
getAbortCommonEvent(callback: AsyncCallback<boolean>): void
```
Checks whether this common event is in the aborted state. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result. Checks whether this common event is in the aborted state. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result.
...@@ -1079,23 +965,26 @@ Checks whether this common event is in the aborted state. This API takes effect ...@@ -1079,23 +965,26 @@ Checks whether this common event is in the aborted state. This API takes effect
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for checking whether the current common event is in the aborted state. // Callback for checking whether the current common event is in the aborted state.
function getAbortCallback(err, AbortCommonEvent) { function getAbortCB(err, abortEvent) {
if (err.code) { if (err.code) {
console.error("getAbortCommonEvent failed " + JSON.stringify(err)); console.error("getAbortCommonEvent failed " + JSON.stringify(err));
} else { } else {
console.info("AbortCommonEvent " + AbortCommonEvent) console.info("abortEvent " + abortEvent)
} }
} }
subscriber.getAbortCommonEvent(getAbortCallback);
subscriber.getAbortCommonEvent(getAbortCB);
``` ```
### getAbortCommonEvent ### getAbortCommonEvent
getAbortCommonEvent(): Promise\<boolean> ```ts
getAbortCommonEvent(): Promise<boolean>
```
Checks whether this common event is in the aborted state. This API takes effect only for ordered common events. It uses a promise to return the result. Checks whether this common event is in the aborted state. This API takes effect only for ordered common events. It uses a promise to return the result.
...@@ -1109,11 +998,11 @@ Checks whether this common event is in the aborted state. This API takes effect ...@@ -1109,11 +998,11 @@ Checks whether this common event is in the aborted state. This API takes effect
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.getAbortCommonEvent().then((AbortCommonEvent) => { subscriber.getAbortCommonEvent().then((abortCommonEvent) => {
console.info("AbortCommonEvent " + JSON.stringify(AbortCommonEvent)); console.info("abortCommonEvent " + JSON.stringify(abortCommonEvent));
}).catch((err) => { }).catch((err) => {
console.error("getAbortCommonEvent failed " + JSON.stringify(err)); console.error("getAbortCommonEvent failed " + JSON.stringify(err));
}); });
...@@ -1121,7 +1010,9 @@ subscriber.getAbortCommonEvent().then((AbortCommonEvent) => { ...@@ -1121,7 +1010,9 @@ subscriber.getAbortCommonEvent().then((AbortCommonEvent) => {
### getSubscribeInfo ### getSubscribeInfo
getSubscribeInfo(callback: AsyncCallback\<CommonEventSubscribeInfo>): void ```ts
getSubscribeInfo(callback: AsyncCallback<CommonEventSubscribeInfo>): void
```
Obtains the subscriber information. This API uses an asynchronous callback to return the result. Obtains the subscriber information. This API uses an asynchronous callback to return the result.
...@@ -1135,23 +1026,26 @@ Obtains the subscriber information. This API uses an asynchronous callback to re ...@@ -1135,23 +1026,26 @@ Obtains the subscriber information. This API uses an asynchronous callback to re
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for subscriber information obtaining. // Callback for subscriber information obtaining.
function getSubscribeInfoCallback(err, SubscribeInfo) { function getCB(err, subscribeInfo) {
if (err.code) { if (err.code) {
console.error("getSubscribeInfo failed " + JSON.stringify(err)); console.error("getSubscribeInfo failed " + JSON.stringify(err));
} else { } else {
console.info("SubscribeInfo " + JSON.stringify(SubscribeInfo)); console.info("SubscribeInfo " + JSON.stringify(subscribeInfo));
} }
} }
subscriber.getSubscribeInfo(getSubscribeInfoCallback);
subscriber.getSubscribeInfo(getCB);
``` ```
### getSubscribeInfo ### getSubscribeInfo
getSubscribeInfo(): Promise\<CommonEventSubscribeInfo> ```ts
getSubscribeInfo(): Promise<CommonEventSubscribeInfo>
```
Obtains the subscriber information. This API uses a promise to return the result. Obtains the subscriber information. This API uses a promise to return the result.
...@@ -1165,11 +1059,11 @@ Obtains the subscriber information. This API uses a promise to return the result ...@@ -1165,11 +1059,11 @@ Obtains the subscriber information. This API uses a promise to return the result
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.getSubscribeInfo().then((SubscribeInfo) => { subscriber.getSubscribeInfo().then((subscribeInfo) => {
console.info("SubscribeInfo " + JSON.stringify(SubscribeInfo)); console.info("subscribeInfo " + JSON.stringify(subscribeInfo));
}).catch((err) => { }).catch((err) => {
console.error("getSubscribeInfo failed " + JSON.stringify(err)); console.error("getSubscribeInfo failed " + JSON.stringify(err));
}); });
...@@ -1177,9 +1071,11 @@ subscriber.getSubscribeInfo().then((SubscribeInfo) => { ...@@ -1177,9 +1071,11 @@ subscriber.getSubscribeInfo().then((SubscribeInfo) => {
### finishCommonEvent<sup>9+</sup> ### finishCommonEvent<sup>9+</sup>
finishCommonEvent(callback: AsyncCallback\<void\>): void ```ts
finishCommonEvent(callback: AsyncCallback<void>): void
```
Finishes this ordered common event. This API uses an asynchronous callback to return the result. Finishes this common event. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -1191,25 +1087,28 @@ Finishes this ordered common event. This API uses an asynchronous callback to re ...@@ -1191,25 +1087,28 @@ Finishes this ordered common event. This API uses an asynchronous callback to re
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for ordered common event finishing. // Callback for ordered common event finishing.
function finishCommonEventCallback(err) { function finishCB(err) {
if (err.code) { if (err.code) {
console.error("finishCommonEvent failed " + JSON.stringify(err)); console.error("finishCommonEvent failed " + JSON.stringify(err));
} else { } else {
console.info("FinishCommonEvent"); console.info("FinishCommonEvent");
} }
} }
subscriber.finishCommonEvent(finishCommonEventCallback);
subscriber.finishCommonEvent(finishCB);
``` ```
### finishCommonEvent<sup>9+</sup> ### finishCommonEvent<sup>9+</sup>
finishCommonEvent(): Promise\<void\> ```ts
finishCommonEvent(): Promise<void>
```
Finishes this ordered common event. This API uses a promise to return the result. Finishes this common event. This API takes effect only for ordered common events. It uses a promise to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -1221,7 +1120,7 @@ Finishes this ordered common event. This API uses a promise to return the result ...@@ -1221,7 +1120,7 @@ Finishes this ordered common event. This API uses a promise to return the result
**Example** **Example**
```js ```ts
let subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.finishCommonEvent().then(() => { subscriber.finishCommonEvent().then(() => {
...@@ -1240,7 +1139,7 @@ Describes the common event data body. ...@@ -1240,7 +1139,7 @@ Describes the common event data body.
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ---------- |-------------------- | ---- | ---- | ------------------------------------------------------- | | ---------- |-------------------- | ---- | ---- | ------------------------------------------------------- |
| event | string | Yes | No | Name of the common event that is being received. | | event | string | Yes | No | Name of the common event that is being received. |
| bundleName | string | Yes | No | Bundle name. | | bundleName | string | Yes | No | Bundle name. |
| code | number | Yes | No | Result code of the common event, which is used to transfer data of the int type. | | code | number | Yes | No | Result code of the common event, which is used to transfer data of the int type. |
| data | string | Yes | No | Custom result data of the common event, which is used to transfer data of the string type.| | data | string | Yes | No | Custom result data of the common event, which is used to transfer data of the string type.|
| parameters | {[key: string]: any} | Yes | No | Additional information about the common event. | | parameters | {[key: string]: any} | Yes | No | Additional information about the common event. |
...@@ -1254,10 +1153,10 @@ Describes the data body published by a common event, including the common event ...@@ -1254,10 +1153,10 @@ Describes the data body published by a common event, including the common event
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| --------------------- | -------------------- | ---- | ---- | ---------------------------- | | --------------------- | -------------------- | ---- | ---- | ---------------------------- |
| bundleName | string | Yes | No | Bundle name. | | bundleName | string | Yes | No | Bundle name. |
| code | number | Yes | No | Result code of the common event. | | code | number | Yes | No | Result code of the common event. |
| data | string | Yes | No | Custom result data of the common event.| | data | string | Yes | No | Custom result data of the common event.|
| subscriberPermissions | Array\<string> | Yes | No | Permissions required for subscribers to receive the common event. | | subscriberPermissions | Array\<string\> | Yes | No | Permissions required for subscribers to receive the common event. |
| isOrdered | boolean | Yes | No | Whether the common event is an ordered one. | | isOrdered | boolean | Yes | No | Whether the common event is an ordered one. |
| isSticky | boolean | Yes | No | Whether the common event is a sticky one. Only system applications and system services are allowed to send sticky events.| | isSticky | boolean | Yes | No | Whether the common event is a sticky one. Only system applications and system services are allowed to send sticky events.|
| parameters | {[key: string]: any} | Yes | No | Additional information about the common event. | | parameters | {[key: string]: any} | Yes | No | Additional information about the common event. |
...@@ -1270,7 +1169,7 @@ Provides the subscriber information. ...@@ -1270,7 +1169,7 @@ Provides the subscriber information.
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ------------------- | -------------- | ---- | ---- | ------------------------------------------------------------ | | ------------------- | -------------- | ---- | ---- | ------------------------------------------------------------ |
| events | Array\<string> | Yes | No | Name of the common event to publish. | | events | Array\<string\> | Yes | No | Name of the common event to publish. |
| publisherPermission | string | Yes | No | Permissions required for publishers to publish the common event. | | publisherPermission | string | Yes | No | Permissions required for publishers to publish the common event. |
| publisherDeviceId | string | Yes | No | Device ID. The value must be the ID of an existing device on the same network. | | publisherDeviceId | string | Yes | No | Device ID. The value must be the ID of an existing device on the same network. |
| userId | number | Yes | No | User ID. The default value is the ID of the current user. If this parameter is specified, the value must be an existing user ID in the system.| | userId | number | Yes | No | User ID. The default value is the ID of the current user. If this parameter is specified, the value must be an existing user ID in the system.|
......
# @ohos.commonEventManager # @ohos.commonEventManager (Common Event)
The **CommonEventManager** module provides common event capabilities, including the capabilities to publish, subscribe to, and unsubscribe from common events, as well obtaining and setting the common event result code and result data. The **CommonEventManager** module provides common event capabilities, including the capabilities to publish, subscribe to, and unsubscribe from common events.
> **NOTE** > **NOTE**
> >
...@@ -14,174 +14,17 @@ import CommonEventManager from '@ohos.commonEventManager'; ...@@ -14,174 +14,17 @@ import CommonEventManager from '@ohos.commonEventManager';
## Support ## Support
The table below lists the event types supported by the **CommonEventManager** module. The name and value indicate the macro and name of a common event, respectively. A system common event is an event that is published by a system service or system application and requires specific permissions to subscribe to. To publish or subscribe to this type of event, you must follow the event-specific definitions.
**System capability**: SystemCapability.Notification.CommonEvent
| Name | Value | Subscriber Permission | Description |
| ------------ | ------------------ | ---------------------- | -------------------- |
| COMMON_EVENT_BOOT_COMPLETED | usual.event.BOOT_COMPLETED | ohos.permission.RECEIVER_STARTUP_COMPLETED | Indicates the common event that the user has finished booting and the system has been loaded. |
| COMMON_EVENT_LOCKED_BOOT_COMPLETED | usual.event.LOCKED_BOOT_COMPLETED | ohos.permission.RECEIVER_STARTUP_COMPLETED | Indicates the common event that the user has finished booting and the system has been loaded but the screen is still locked. |
| COMMON_EVENT_SHUTDOWN | usual.event.SHUTDOWN | - | Indicates the common event that the device is being shut down and the final shutdown will proceed. |
| COMMON_EVENT_BATTERY_CHANGED | usual.event.BATTERY_CHANGED | - | Indicates the common event that the charging state, level, and other information about the battery have changed. |
| COMMON_EVENT_BATTERY_LOW | usual.event.BATTERY_LOW | - | Indicates the common event that the battery level is low. |
| COMMON_EVENT_BATTERY_OKAY | usual.event.BATTERY_OKAY | - | Indicates the common event that the battery exits the low state. |
| COMMON_EVENT_POWER_CONNECTED | usual.event.POWER_CONNECTED | - | Indicates the common event that the device is connected to an external power supply. |
| COMMON_EVENT_POWER_DISCONNECTED | usual.event.POWER_DISCONNECTED | - | Indicates the common event that the device is disconnected from the external power supply. |
| COMMON_EVENT_SCREEN_OFF | usual.event.SCREEN_OFF | - | Indicates the common event that the device screen is off and the device is sleeping. |
| COMMON_EVENT_SCREEN_ON | usual.event.SCREEN_ON | - | Indicates the common event that the device screen is on and the device is in interactive state. |
| COMMON_EVENT_THERMAL_LEVEL_CHANGED | usual.event.THERMAL_LEVEL_CHANGED | - | Indicates the common event that the device's thermal level has changed. |
| COMMON_EVENT_USER_PRESENT | usual.event.USER_PRESENT | - | Indicates the common event that the user unlocks the device. |
| COMMON_EVENT_TIME_TICK | usual.event.TIME_TICK | - | Indicates the common event that the system time has changed. |
| COMMON_EVENT_TIME_CHANGED | usual.event.TIME_CHANGED | - | Indicates the common event that the system time is set. |
| COMMON_EVENT_DATE_CHANGED | usual.event.DATE_CHANGED | - | Indicates the common event that the system time has changed. |
| COMMON_EVENT_TIMEZONE_CHANGED | usual.event.TIMEZONE_CHANGED | - | Indicates the common event that the system time zone has changed. |
| COMMON_EVENT_CLOSE_SYSTEM_DIALOGS | usual.event.CLOSE_SYSTEM_DIALOGS | - | Indicates the common event that a user closes a temporary system dialog box. |
| COMMON_EVENT_PACKAGE_ADDED | usual.event.PACKAGE_ADDED | - | Indicates the common event that a new application package has been installed on the device. |
| COMMON_EVENT_PACKAGE_REPLACED | usual.event.PACKAGE_REPLACED | - | Indicates the common event that a later version of an installed application package has replaced the previous one on the device. |
| COMMON_EVENT_MY_PACKAGE_REPLACED | usual.event.MY_PACKAGE_REPLACED | - | Indicates the common event that a later version of your application package has replaced the previous one.
| COMMON_EVENT_PACKAGE_REMOVED | usual.event.PACKAGE_REMOVED | - | Indicates the common event that an installed application has been uninstalled from the device with the application data retained. |
| COMMON_EVENT_BUNDLE_REMOVED | usual.event.BUNDLE_REMOVED | - | Indicates the common event that an installed bundle has been uninstalled from the device with the application data retained. |
| COMMON_EVENT_PACKAGE_FULLY_REMOVED | usual.event.PACKAGE_FULLY_REMOVED | - | Indicates the common event that an installed application, including both the application data and code, has been completely uninstalled from the device. |
| COMMON_EVENT_PACKAGE_CHANGED | usual.event.PACKAGE_CHANGED | - | Indicates the common event that an application package has been changed (for example, a component in the package has been enabled or disabled). |
| COMMON_EVENT_PACKAGE_RESTARTED | usual.event.PACKAGE_RESTARTED | - | Indicates the common event that the user has restarted the application package and killed all its processes. |
| COMMON_EVENT_PACKAGE_DATA_CLEARED | usual.event.PACKAGE_DATA_CLEARED | - | Indicates the common event that the user has cleared the application package data. |
| COMMON_EVENT_PACKAGE_CACHE_CLEARED<sup>9+</sup> | usual.event.PACKAGE_CACHE_CLEARED | - | Indicates the common event that the user has cleared the application package data. |
| COMMON_EVENT_PACKAGES_SUSPENDED | usual.event.PACKAGES_SUSPENDED | - | Indicates the common event that application packages have been suspended. |
| COMMON_EVENT_PACKAGES_UNSUSPENDED | usual.event.PACKAGES_UNSUSPENDED | - | Indicates the common event that application package has not been suspended. |
| COMMON_EVENT_MY_PACKAGE_SUSPENDED | usual.event.MY_PACKAGE_SUSPENDED | - | Indicates the common event that an application package has been suspended. |
| COMMON_EVENT_MY_PACKAGE_UNSUSPENDED | usual.event.MY_PACKAGE_UNSUSPENDED | - | Indicates the common event that application package has not been suspended. |
| COMMON_EVENT_UID_REMOVED | usual.event.UID_REMOVED | - | Indicates the common event that a user ID has been removed from the system. |
| COMMON_EVENT_PACKAGE_FIRST_LAUNCH | usual.event.PACKAGE_FIRST_LAUNCH | - | Indicates the common event that an installed application is started for the first time. |
| COMMON_EVENT_PACKAGE_NEEDS_VERIFICATION | usual.event.PACKAGE_NEEDS_VERIFICATION | - | Indicates the common event that an application requires system verification. |
| COMMON_EVENT_PACKAGE_VERIFIED | usual.event.PACKAGE_VERIFIED | - | Indicates the common event that an application has been verified by the system. |
| COMMON_EVENT_EXTERNAL_APPLICATIONS_AVAILABLE | usual.event.EXTERNAL_APPLICATIONS_AVAILABLE | - | Indicates the common event that applications installed on the external storage become available for the system. |
| COMMON_EVENT_EXTERNAL_APPLICATIONS_UNAVAILABLE | usual.event.EXTERNAL_APPLICATIONS_UNAVAILABLE | - | Indicates the common event that applications installed on the external storage become unavailable for the system. |
| COMMON_EVENT_CONFIGURATION_CHANGED | usual.event.CONFIGURATION_CHANGED | - | Indicates the common event that the device state (for example, orientation and locale) has changed. |
| COMMON_EVENT_LOCALE_CHANGED | usual.event.LOCALE_CHANGED | - | Indicates the common event that the device locale has changed. |
| COMMON_EVENT_MANAGE_PACKAGE_STORAGE | usual.event.MANAGE_PACKAGE_STORAGE | - | Indicates the common event that the device storage is insufficient. |
| COMMON_EVENT_DRIVE_MODE | common.event.DRIVE_MODE | - | Indicates the common event that the system is in driving mode. |
| COMMON_EVENT_HOME_MODE | common.event.HOME_MODE | - | Indicates the common event that the system is in home mode. |
| COMMON_EVENT_OFFICE_MODE | common.event.OFFICE_MODE | - | Indicates the common event that the system is in office mode. |
| COMMON_EVENT_USER_STARTED | usual.event.USER_STARTED | - | Indicates the common event that the user has been started. |
| COMMON_EVENT_USER_BACKGROUND | usual.event.USER_BACKGROUND | - | Indicates the common event that the user has been brought to the background. |
| COMMON_EVENT_USER_FOREGROUND | usual.event.USER_FOREGROUND | - | Indicates the common event that the user has been brought to the foreground. |
| COMMON_EVENT_USER_SWITCHED | usual.event.USER_SWITCHED | ohos.permission.MANAGE_LOCAL_ACCOUNTS | Indicates the common event that user switching is happening. |
| COMMON_EVENT_USER_STARTING | usual.event.USER_STARTING | ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS | Indicates the common event that the user is going to be started. |
| COMMON_EVENT_USER_UNLOCKED | usual.event.USER_UNLOCKED | - | Indicates the common event that the credential-encrypted storage has been unlocked for the current user when the device is unlocked after being restarted. |
| COMMON_EVENT_USER_STOPPING | usual.event.USER_STOPPING | ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS | Indicates the common event that the user is going to be stopped. |
| COMMON_EVENT_USER_STOPPED | usual.event.USER_STOPPED | - | Indicates the common event that the user has been stopped. |
| COMMON_EVENT_DISTRIBUTED_ACCOUNT_LOGIN | usual.event.DISTRIBUTED_ACCOUNT_LOGIN | - | Indicates the action of successful login using a distributed account. |
| COMMON_EVENT_DISTRIBUTED_ACCOUNT_LOGOUT | usual.event.DISTRIBUTED_ACCOUNT_LOGOUT | - | Indicates the action of successful logout of a distributed account. |
| COMMON_EVENT_DISTRIBUTED_ACCOUNT_TOKEN_INVALID | usual.event.DISTRIBUTED_ACCOUNT_TOKEN_INVALID | - | Indicates the action when the token of a distributed account is invalid. |
| COMMON_EVENT_DISTRIBUTED_ACCOUNT_LOGOFF | usual.event.DISTRIBUTED_ACCOUNT_LOGOFF | - | Indicates the action of deregistering a distributed account. |
| COMMON_EVENT_WIFI_POWER_STATE | usual.event.wifi.POWER_STATE | - | Indicates the common event about the Wi-Fi network state, such as enabled and disabled. |
| COMMON_EVENT_WIFI_SCAN_FINISHED | usual.event.wifi.SCAN_FINISHED | ohos.permission.LOCATION | Indicates the common event that the Wi-Fi access point has been scanned and proven to be available. |
| COMMON_EVENT_WIFI_RSSI_VALUE | usual.event.wifi.RSSI_VALUE | ohos.permission.GET_WIFI_INFO | Indicates the common event that the Wi-Fi signal strength (RSSI) has changed. |
| COMMON_EVENT_WIFI_CONN_STATE | usual.event.wifi.CONN_STATE | - | Indicates the common event that the Wi-Fi connection state has changed. |
| COMMON_EVENT_WIFI_HOTSPOT_STATE | usual.event.wifi.HOTSPOT_STATE | - | Indicates the common event about the Wi-Fi hotspot state, such as enabled or disabled. |
| COMMON_EVENT_WIFI_AP_STA_JOIN | usual.event.wifi.WIFI_HS_STA_JOIN | ohos.permission.GET_WIFI_INFO | Indicates the common event that a client has joined the Wi-Fi hotspot of the current device. |
| COMMON_EVENT_WIFI_AP_STA_LEAVE | usual.event.wifi.WIFI_HS_STA_LEAVE | ohos.permission.GET_WIFI_INFO |Indicates the common event that a client has disconnected from the Wi-Fi hotspot of the current device. |
| COMMON_EVENT_WIFI_MPLINK_STATE_CHANGE | usual.event.wifi.mplink.STATE_CHANGE | ohos.permission.MPLINK_CHANGE_STATE | Indicates the common event that the state of MPLINK (an enhanced Wi-Fi feature) has changed. |
| COMMON_EVENT_WIFI_P2P_CONN_STATE | usual.event.wifi.p2p.CONN_STATE_CHANGE | ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION | Indicates the common event that the Wi-Fi P2P connection state has changed. |
| COMMON_EVENT_WIFI_P2P_STATE_CHANGED | usual.event.wifi.p2p.STATE_CHANGE | ohos.permission.GET_WIFI_INFO | Indicates the common event about the Wi-Fi P2P state, such as enabled and disabled. |
| COMMON_EVENT_WIFI_P2P_PEERS_STATE_CHANGED | usual.event.wifi.p2p.DEVICES_CHANGE | ohos.permission.GET_WIFI_INFO | Indicates the common event about the status change of Wi-Fi P2P peer devices. |
| COMMON_EVENT_WIFI_P2P_PEERS_DISCOVERY_STATE_CHANGED | usual.event.wifi.p2p.PEER_DISCOVERY_STATE_CHANGE | ohos.permission.GET_WIFI_INFO | Indicates the common event about the Wi-Fi P2P discovery status change. |
| COMMON_EVENT_WIFI_P2P_CURRENT_DEVICE_STATE_CHANGED | usual.event.wifi.p2p.CURRENT_DEVICE_CHANGE | ohos.permission.GET_WIFI_INFO | Indicates the common event about the status change of the Wi-Fi P2P local device. |
| COMMON_EVENT_WIFI_P2P_GROUP_STATE_CHANGED | usual.event.wifi.p2p.GROUP_STATE_CHANGED | ohos.permission.GET_WIFI_INFO | Indicates the common event that the Wi-Fi P2P group information has changed. |
| COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CONNECT_STATE_UPDATE | usual.event.bluetooth.handsfree.ag.CONNECT_STATE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event about the connection state of Bluetooth handsfree communication. |
| COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CURRENT_DEVICE_UPDATE | usual.event.bluetooth.handsfree.ag.CURRENT_DEVICE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the device connected to the Bluetooth handsfree is active. |
| COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_AUDIO_STATE_UPDATE | usual.event.bluetooth.handsfree.ag.AUDIO_STATE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the connection state of Bluetooth A2DP has changed. |
| COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CONNECT_STATE_UPDATE | usual.event.bluetooth.a2dpsource.CONNECT_STATE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event about the connection state of Bluetooth A2DP. |
| COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CURRENT_DEVICE_UPDATE | usual.event.bluetooth.a2dpsource.CURRENT_DEVICE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the device connected using Bluetooth A2DP is active. |
| COMMON_EVENT_BLUETOOTH_A2DPSOURCE_PLAYING_STATE_UPDATE | usual.event.bluetooth.a2dpsource.PLAYING_STATE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the playing state of Bluetooth A2DP has changed. |
| COMMON_EVENT_BLUETOOTH_A2DPSOURCE_AVRCP_CONNECT_STATE_UPDATE | usual.event.bluetooth.a2dpsource.AVRCP_CONNECT_STATE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the AVRCP connection state of Bluetooth A2DP has changed. |
| COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CODEC_VALUE_UPDATE | usual.event.bluetooth.a2dpsource.CODEC_VALUE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the audio codec state of Bluetooth A2DP has changed. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_DISCOVERED | usual.event.bluetooth.remotedevice.DISCOVERED | ohos.permission.LOCATION and ohos.permission.USE_BLUETOOTH | Indicates the common event that a remote Bluetooth device is discovered. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CLASS_VALUE_UPDATE | usual.event.bluetooth.remotedevice.CLASS_VALUE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the Bluetooth class of a remote Bluetooth device has changed. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_CONNECTED | usual.event.bluetooth.remotedevice.ACL_CONNECTED | ohos.permission.USE_BLUETOOTH | Indicates the common event that a low-ACL connection has been established with a remote Bluetooth device. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_DISCONNECTED | usual.event.bluetooth.remotedevice.ACL_DISCONNECTED | ohos.permission.USE_BLUETOOTH | Indicates the common event that a low-ACL connection has been disconnected from a remote Bluetooth device. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_NAME_UPDATE | usual.event.bluetooth.remotedevice.NAME_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the friendly name of a remote Bluetooth device is retrieved for the first time or is changed since the last retrieval. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIR_STATE | usual.event.bluetooth.remotedevice.PAIR_STATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the connection state of a remote Bluetooth device has changed. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_BATTERY_VALUE_UPDATE | usual.event.bluetooth.remotedevice.BATTERY_VALUE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the battery level of a remote Bluetooth device is retrieved for the first time or is changed since the last retrieval. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_SDP_RESULT | usual.event.bluetooth.remotedevice.SDP_RESULT | - | Indicates the common event about the SDP state of a remote Bluetooth device. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_UUID_VALUE | usual.event.bluetooth.remotedevice.UUID_VALUE | ohos.permission.DISCOVER_BLUETOOTH | Indicates the common event about the UUID connection state of a remote Bluetooth device. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_REQ | usual.event.bluetooth.remotedevice.PAIRING_REQ | ohos.permission.DISCOVER_BLUETOOTH | Indicates the common event about the pairing request from a remote Bluetooth device. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_CANCEL | usual.event.bluetooth.remotedevice.PAIRING_CANCEL | - | Indicates the common event that Bluetooth pairing is canceled. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REQ | usual.event.bluetooth.remotedevice.CONNECT_REQ | - | Indicates the common event about the connection request from a remote Bluetooth device. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REPLY | usual.event.bluetooth.remotedevice.CONNECT_REPLY | - | Indicates the common event about the response to the connection request from a remote Bluetooth device. |
| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_CANCEL | usual.event.bluetooth.remotedevice.CONNECT_CANCEL | - | Indicates the common event that the connection to a remote Bluetooth device has been canceled. |
| COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_CONNECT_STATE_UPDATE | usual.event.bluetooth.handsfreeunit.CONNECT_STATE_UPDATE | - | Indicates the common event that the connection state of a Bluetooth handsfree has changed. |
| COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AUDIO_STATE_UPDATE | usual.event.bluetooth.handsfreeunit.AUDIO_STATE_UPDATE | - | Indicates the common event that the audio state of a Bluetooth handsfree has changed. |
| COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_COMMON_EVENT | usual.event.bluetooth.handsfreeunit.AG_COMMON_EVENT | - | Indicates the common event that the audio gateway state of a Bluetooth handsfree has changed. |
| COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_CALL_STATE_UPDATE | usual.event.bluetooth.handsfreeunit.AG_CALL_STATE_UPDATE | - | Indicates the common event that the calling state of a Bluetooth handsfree has changed. |
| COMMON_EVENT_BLUETOOTH_HOST_STATE_UPDATE | usual.event.bluetooth.host.STATE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the state of a Bluetooth adapter has been changed, for example, Bluetooth has been enabled or disabled. |
| COMMON_EVENT_BLUETOOTH_HOST_REQ_DISCOVERABLE | usual.event.bluetooth.host.REQ_DISCOVERABLE | - | Indicates the common event about the request for the user to allow Bluetooth device scanning. |
| COMMON_EVENT_BLUETOOTH_HOST_REQ_ENABLE | usual.event.bluetooth.host.REQ_ENABLE | ohos.permission.USE_BLUETOOTH | Indicates the common event about the request for the user to enable Bluetooth. |
| COMMON_EVENT_BLUETOOTH_HOST_REQ_DISABLE | usual.event.bluetooth.host.REQ_DISABLE | ohos.permission.USE_BLUETOOTH | Indicates the common event about the request for the user to disable Bluetooth. |
| COMMON_EVENT_BLUETOOTH_HOST_SCAN_MODE_UPDATE | usual.event.bluetooth.host.SCAN_MODE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the Bluetooth scanning mode of a device has changed. |
| COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_STARTED | usual.event.bluetooth.host.DISCOVERY_STARTED | ohos.permission.USE_BLUETOOTH | Indicates the common event that the Bluetooth scanning has been started on the device. |
| COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_FINISHED | usual.event.bluetooth.host.DISCOVERY_FINISHED | ohos.permission.USE_BLUETOOTH | Indicates the common event that the Bluetooth scanning is finished on the device. |
| COMMON_EVENT_BLUETOOTH_HOST_NAME_UPDATE | usual.event.bluetooth.host.NAME_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the Bluetooth adapter name of the device has changed. |
| COMMON_EVENT_BLUETOOTH_A2DPSINK_CONNECT_STATE_UPDATE | usual.event.bluetooth.a2dpsink.CONNECT_STATE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the connection state of Bluetooth A2DP Sink has changed. |
| COMMON_EVENT_BLUETOOTH_A2DPSINK_PLAYING_STATE_UPDATE | usual.event.bluetooth.a2dpsink.PLAYING_STATE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the playing state of Bluetooth A2DP Sink has changed. |
| COMMON_EVENT_BLUETOOTH_A2DPSINK_AUDIO_STATE_UPDATE | usual.event.bluetooth.a2dpsink.AUDIO_STATE_UPDATE | ohos.permission.USE_BLUETOOTH | Indicates the common event that the audio state of Bluetooth A2DP Sink has changed. |
| COMMON_EVENT_NFC_ACTION_ADAPTER_STATE_CHANGED | usual.event.nfc.action.ADAPTER_STATE_CHANGED | - | Indicates the common event that the state of the device's NFC adapter has changed. |
| COMMON_EVENT_NFC_ACTION_RF_FIELD_ON_DETECTED | usual.event.nfc.action.RF_FIELD_ON_DETECTED | ohos.permission.MANAGE_SECURE_SETTINGS | Indicates the action of a common event that the NFC RF field is detected to be in the enabled state. |
| COMMON_EVENT_NFC_ACTION_RF_FIELD_OFF_DETECTED | usual.event.nfc.action.RF_FIELD_OFF_DETECTED | ohos.permission.MANAGE_SECURE_SETTINGS | Indicates the common event that the NFC RF field is detected to be in the disabled state. |
| COMMON_EVENT_DISCHARGING | usual.event.DISCHARGING | - | Indicates the common event that the system stops charging the battery. |
| COMMON_EVENT_CHARGING | usual.event.CHARGING | - | Indicates the common event that the system starts charging the battery. |
| COMMON_EVENT_DEVICE_IDLE_MODE_CHANGED | usual.event.DEVICE_IDLE_MODE_CHANGED | - | Indicates the common event that the system idle mode has changed. |
| COMMON_EVENT_POWER_SAVE_MODE_CHANGED | usual.event.POWER_SAVE_MODE_CHANGED | - | Indicates the common event that the power saving mode of the system has changed. |
| COMMON_EVENT_USER_ADDED | usual.event.USER_ADDED | ohos.permission.MANAGE_LOCAL_ACCOUNTS | Indicates the common event that a user has been added to the system. |
| COMMON_EVENT_USER_REMOVED | usual.event.USER_REMOVED | ohos.permission.MANAGE_LOCAL_ACCOUNTS | Indicates the common event that a user has been removed from the system. |
| COMMON_EVENT_ABILITY_ADDED | usual.event.ABILITY_ADDED | ohos.permission.LISTEN_BUNDLE_CHANGE | Indicates the common event that an ability has been added. |
| COMMON_EVENT_ABILITY_REMOVED | usual.event.ABILITY_REMOVED | ohos.permission.LISTEN_BUNDLE_CHANGE | Indicates the common event that an ability has been removed. |
| COMMON_EVENT_ABILITY_UPDATED | usual.event.ABILITY_UPDATED | ohos.permission.LISTEN_BUNDLE_CHANGE | Indicates the common event that an ability has been updated. |
| COMMON_EVENT_LOCATION_MODE_STATE_CHANGED | usual.event.location.MODE_STATE_CHANGED | - | Indicates the common event that the location mode of the system has changed. |
| COMMON_EVENT_IVI_SLEEP | common.event.IVI_SLEEP | - | Indicates the common event that the in-vehicle infotainment (IVI) system of a vehicle is sleeping. |
| COMMON_EVENT_IVI_PAUSE | common.event.IVI_PAUSE | - | Indicates the common event that the IVI system of a vehicle has entered sleep mode and the playing application is instructed to stop playback. |
| COMMON_EVENT_IVI_STANDBY | common.event.IVI_STANDBY | - | Indicates the common event that a third-party application is instructed to pause the current work. |
| COMMON_EVENT_IVI_LASTMODE_SAVE | common.event.IVI_LASTMODE_SAVE | - | Indicates the common event that a third-party application is instructed to save its last mode. |
| COMMON_EVENT_IVI_VOLTAGE_ABNORMAL | common.event.IVI_VOLTAGE_ABNORMAL | - | Indicates the common event that the voltage of the vehicle's power system is abnormal. |
| COMMON_EVENT_IVI_HIGH_TEMPERATURE | common.event.IVI_HIGH_TEMPERATURE | - | Indicates the common event that the temperature of the IVI system is high. |
| COMMON_EVENT_IVI_EXTREME_TEMPERATURE | common.event.IVI_EXTREME_TEMPERATURE | - | Indicates the common event that the temperature of the IVI system is extremely high. |
| COMMON_EVENT_IVI_TEMPERATURE_ABNORMAL | common.event.IVI_TEMPERATURE_ABNORMAL | - | Indicates the common event that the IVI system has an extreme temperature. |
| COMMON_EVENT_IVI_VOLTAGE_RECOVERY | common.event.IVI_VOLTAGE_RECOVERY | - | Indicates the common event that the voltage of the vehicle's power system is restored to normal. |
| COMMON_EVENT_IVI_TEMPERATURE_RECOVERY | common.event.IVI_TEMPERATURE_RECOVERY | - | Indicates the common event that the temperature of the IVI system is restored to normal. |
| COMMON_EVENT_IVI_ACTIVE | common.event.IVI_ACTIVE | - | Indicates the common event that the battery service is active. |
|COMMON_EVENT_USB_STATE<sup>9+</sup> | usual.event.hardware.usb.action.USB_STATE | - | Indicates a common event indicating that the USB device status changes. |
|COMMON_EVENT_USB_PORT_CHANGED<sup>9+</sup> | usual.event.hardware.usb.action.USB_PORT_CHANGED | - | Indicates the public event that the USB port status of the user device changes. |
| COMMON_EVENT_USB_DEVICE_ATTACHED | usual.event.hardware.usb.action.USB_DEVICE_ATTACHED | - | Indicates the common event that a USB device has been attached when the user device functions as a USB host. |
| COMMON_EVENT_USB_DEVICE_DETACHED | usual.event.hardware.usb.action.USB_DEVICE_DETACHED | - | Indicates the common event that a USB device has been detached when the user device functions as a USB host. |
| COMMON_EVENT_USB_ACCESSORY_ATTACHED | usual.event.hardware.usb.action.USB_ACCESSORY_ATTACHED | - | Indicates the common event that a USB accessory was attached. |
| COMMON_EVENT_USB_ACCESSORY_DETACHED | usual.event.hardware.usb.action.USB_ACCESSORY_DETACHED | - | Indicates the common event that a USB accessory was detached. |
| COMMON_EVENT_DISK_REMOVED | usual.event.data.DISK_REMOVED | ohos.permission.STORAGE_MANAGER | Indicates the common event that an external storage device was removed. |
| COMMON_EVENT_DISK_UNMOUNTED | usual.event.data.DISK_UNMOUNTED | ohos.permission.STORAGE_MANAGER | Indicates the common event that an external storage device was unmounted. |
| COMMON_EVENT_DISK_MOUNTED | usual.event.data.DISK_MOUNTED | ohos.permission.STORAGE_MANAGER | Indicates the common event that an external storage device was mounted. |
| COMMON_EVENT_DISK_BAD_REMOVAL | usual.event.data.DISK_BAD_REMOVAL | ohos.permission.STORAGE_MANAGER | Indicates the common event that an external storage device was removed without being unmounted. |
| COMMON_EVENT_DISK_UNMOUNTABLE | usual.event.data.DISK_UNMOUNTABLE | ohos.permission.STORAGE_MANAGER | Indicates the common event that an external storage device becomes unmountable. |
| COMMON_EVENT_DISK_EJECT | usual.event.data.DISK_EJECT | ohos.permission.STORAGE_MANAGER | Indicates the common event that an external storage device was ejected. |
| COMMON_EVENT_VOLUME_REMOVED<sup>9+<sup> | usual.event.data.VOLUME_REMOVED | ohos.permission.STORAGE_MANAGER | Indicates the common event that an external storage device was removed. |
| COMMON_EVENT_VOLUME_UNMOUNTED<sup>9+<sup> | usual.event.data.VOLUME_UNMOUNTED | ohos.permission.STORAGE_MANAGER | Indicates the common event that an external storage device was unmounted. |
| COMMON_EVENT_VOLUME_MOUNTED<sup>9+<sup> | usual.event.data.VOLUME_MOUNTED | ohos.permission.STORAGE_MANAGER | Indicates the common event that an external storage device was mounted. |
| COMMON_EVENT_VOLUME_BAD_REMOVAL<sup>9+<sup> | usual.event.data.VOLUME_BAD_REMOVAL | ohos.permission.STORAGE_MANAGER | Indicates the common event that an external storage device was removed without being unmounted. |
| COMMON_EVENT_VOLUME_EJECT<sup>9+<sup> | usual.event.data.VOLUME_EJECT | ohos.permission.STORAGE_MANAGER | Indicates the common event that an external storage device was ejected. |
| COMMON_EVENT_VISIBLE_ACCOUNTS_UPDATED | usual.event.data.VISIBLE_ACCOUNTS_UPDATED | ohos.permission.GET_APP_ACCOUNTS | Indicates the common event that the account visibility changed. |
| COMMON_EVENT_ACCOUNT_DELETED | usual.event.data.ACCOUNT_DELETED | ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS | Indicates the common event that the account was deleted. |
| COMMON_EVENT_FOUNDATION_READY | usual.event.data.FOUNDATION_READY | ohos.permission.RECEIVER_STARTUP_COMPLETED | Indicates the common event that the foundation is ready. |
| COMMON_EVENT_AIRPLANE_MODE_CHANGED | usual.event.AIRPLANE_MODE | - | Indicates the common event that the airplane mode of the device has changed. |
| COMMON_EVENT_SPLIT_SCREEN | usual.event.SPLIT_SCREEN | ohos.permission.RECEIVER_SPLIT_SCREEN | Indicates the common event of screen splitting. |
| COMMON_EVENT_SLOT_CHANGE<sup>9+<sup> | usual.event.SLOT_CHANGE | ohos.permission.NOTIFICATION_CONTROLLER | Indicates the common event that the notification slot has been updated. |
| COMMON_EVENT_SPN_INFO_CHANGED <sup>9+<sup> | usual.event.SPN_INFO_CHANGED | - | Indicates the common event that the SPN displayed has been updated. |
| COMMON_EVENT_QUICK_FIX_APPLY_RESULT <sup>9+<sup> | usual.event.QUICK_FIX_APPLY_RESULT | - | Indicates the common event that a quick fix is applied to the application. |
For details about the definitions of all system common events, see [System Common Events](./commonEventManager-definitions.md).
## CommonEventManager.publish ## CommonEventManager.publish
publish(event: string, callback: AsyncCallback\<void>): void ```ts
publish(event: string, callback: AsyncCallback<void>): void
```
Publishes a common event. This API uses an asynchronous callback to return the result. Publishes a common event and executes an asynchronous callback after the event is published.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -190,23 +33,17 @@ Publishes a common event. This API uses an asynchronous callback to return the r ...@@ -190,23 +33,17 @@ Publishes a common event. This API uses an asynchronous callback to return the r
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ---------------------- | | -------- | -------------------- | ---- | ---------------------- |
| event | string | Yes | Name of the common event to publish.| | event | string | Yes | Name of the common event to publish.|
| callback | AsyncCallback\<void> | Yes | Callback used to return the result.| | callback | AsyncCallback\<void> | Yes | Callback to execute after the event is published.|
**Error codes** **Error codes**
For details about the error codes, see [Event Error Codes](../errorcodes/errorcode-CommonEventService.md).
|ID |Error Message | For details about the error codes, see [Event Error Codes](../errorcodes/errorcode-CommonEventService.md).
|-----------|--------------------|
|1500004 |not System services or System app|
|1500007 |message send error|
|1500008 |CEMS error|
|1500009 |system error|
**Example** **Example**
```ts ```ts
// Callback for common event publication // Callback for common event publication
function publishCallBack(err) { function publishCB(err) {
if (err) { if (err) {
console.error("publish failed " + JSON.stringify(err)); console.error("publish failed " + JSON.stringify(err));
} else { } else {
...@@ -216,7 +53,7 @@ function publishCallBack(err) { ...@@ -216,7 +53,7 @@ function publishCallBack(err) {
// Publish a common event. // Publish a common event.
try { try {
CommonEventManager.publish("event", publishCallBack); CommonEventManager.publish("event", publishCB);
} catch(err) { } catch(err) {
console.error('publish failed, catch error' + JSON.stringify(err)); console.error('publish failed, catch error' + JSON.stringify(err));
} }
...@@ -224,7 +61,9 @@ try { ...@@ -224,7 +61,9 @@ try {
## CommonEventManager.publish ## CommonEventManager.publish
publish(event: string, options: CommonEventPublishData, callback: AsyncCallback\<void>): void ```ts
publish(event: string, options: CommonEventPublishData, callback: AsyncCallback<void>): void
```
Publishes a common event with given attributes. This API uses an asynchronous callback to return the result. Publishes a common event with given attributes. This API uses an asynchronous callback to return the result.
...@@ -239,27 +78,21 @@ Publishes a common event with given attributes. This API uses an asynchronous ca ...@@ -239,27 +78,21 @@ Publishes a common event with given attributes. This API uses an asynchronous ca
| callback | syncCallback\<void> | Yes | Callback used to return the result. | | callback | syncCallback\<void> | Yes | Callback used to return the result. |
**Error codes** **Error codes**
|ID |Error Message |
|-----------|--------------------|
|1500004 |not System services or System app|
|1500007 |message send error|
|1500008 |CEMS error|
|1500009 |system error|
For details about the error codes, see [Event Error Codes](../errorcodes/errorcode-CommonEventService.md).
**Example** **Example**
```ts ```ts
// Attributes of a common event. // Attributes of a common event.
var options = { let options = {
code: 0, // Result code of the common event. code: 0, // Initial code of the common event.
data: "initial data";// Result data of the common event. data: "initial data";// Initial data of the common event.
isOrdered: true // The common event is an ordered one. isOrdered: true // The common event is an ordered one.
} }
// Callback for common event publication // Callback for common event publication
function publishCallBack(err) { function publishCB(err) {
if (err) { if (err) {
console.error("publish failed " + JSON.stringify(err)); console.error("publish failed " + JSON.stringify(err));
} else { } else {
...@@ -269,17 +102,17 @@ function publishCallBack(err) { ...@@ -269,17 +102,17 @@ function publishCallBack(err) {
// Publish a common event. // Publish a common event.
try { try {
CommonEventManager.publish("event", options, publishCallBack); CommonEventManager.publish("event", options, publishCB);
} catch (err) { } catch (err) {
console.error('publish failed, catch error' + JSON.stringify(err)); console.error('publish failed, catch error' + JSON.stringify(err));
} }
``` ```
## CommonEventManager.publishAsUser<sup> ## CommonEventManager.publishAsUser<sup>
publishAsUser(event: string, userId: number, callback: AsyncCallback\<void>): void ```ts
publishAsUser(event: string, userId: number, callback: AsyncCallback<void>): void
```
Publishes a common event to a specific user. This API uses an asynchronous callback to return the result. Publishes a common event to a specific user. This API uses an asynchronous callback to return the result.
...@@ -296,18 +129,14 @@ Publishes a common event to a specific user. This API uses an asynchronous callb ...@@ -296,18 +129,14 @@ Publishes a common event to a specific user. This API uses an asynchronous callb
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. | | callback | AsyncCallback\<void> | Yes | Callback used to return the result. |
**Error codes** **Error codes**
|ID |Error Message |
|-----------|--------------------| For details about the error codes, see [Event Error Codes](../errorcodes/errorcode-CommonEventService.md).
|1500004 |not System services or System app|
|1500007 |message send error|
|1500008 |CEMS error|
|1500009 |system error|
**Example** **Example**
```ts ```ts
// Callback for common event publication // Callback for common event publication
function publishAsUserCallBack(err) { function publishCB(err) {
if (err) { if (err) {
console.error("publishAsUser failed " + JSON.stringify(err)); console.error("publishAsUser failed " + JSON.stringify(err));
} else { } else {
...@@ -316,21 +145,21 @@ function publishAsUserCallBack(err) { ...@@ -316,21 +145,21 @@ function publishAsUserCallBack(err) {
} }
// Specify the user to whom the common event will be published. // Specify the user to whom the common event will be published.
var userId = 100; let userId = 100;
// Publish a common event. // Publish a common event.
try { try {
CommonEventManager.publishAsUser("event", userId, publishAsUserCallBack); CommonEventManager.publishAsUser("event", userId, publishCB);
} catch (err) { } catch (err) {
console.error('publishAsUser failed, catch error' + JSON.stringify(err)); console.error('publishAsUser failed, catch error' + JSON.stringify(err));
} }
``` ```
## CommonEventManager.publishAsUser ## CommonEventManager.publishAsUser
publishAsUser(event: string, userId: number, options: CommonEventPublishData, callback: AsyncCallback\<void>): void ```ts
publishAsUser(event: string, userId: number, options: CommonEventPublishData, callback: AsyncCallback<void>): void
```
Publishes a common event with given attributes to a specific user. This API uses an asynchronous callback to return the result. Publishes a common event with given attributes to a specific user. This API uses an asynchronous callback to return the result.
...@@ -348,25 +177,21 @@ Publishes a common event with given attributes to a specific user. This API uses ...@@ -348,25 +177,21 @@ Publishes a common event with given attributes to a specific user. This API uses
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. | | callback | AsyncCallback\<void> | Yes | Callback used to return the result. |
**Error codes** **Error codes**
|ID |Error Message |
|-----------|--------------------| For details about the error codes, see [Event Error Codes](../errorcodes/errorcode-CommonEventService.md).
|1500004 |not System services or System app|
|1500007 |message send error|
|1500008 |CEMS error|
|1500009 |system error|
**Example** **Example**
```ts ```ts
// Attributes of a common event. // Attributes of a common event.
var options = { let options = {
code: 0, // Result code of the common event. code: 0, // Initial code of the common event.
data: "initial data";// Result data of the common event. data: "initial data";// Initial data of the common event.
} }
// Callback for common event publication // Callback for common event publication.
function publishAsUserCallBack(err) { function publishCB(err) {
if (err) { if (err) {
console.error("publishAsUser failed " + JSON.stringify(err)); console.error("publishAsUser failed " + JSON.stringify(err));
} else { } else {
...@@ -375,21 +200,21 @@ function publishAsUserCallBack(err) { ...@@ -375,21 +200,21 @@ function publishAsUserCallBack(err) {
} }
// Specify the user to whom the common event will be published. // Specify the user to whom the common event will be published.
var userId = 100; let userId = 100;
// Publish a common event. // Publish a common event.
try { try {
CommonEventManager.publishAsUser("event", userId, options, publishAsUserCallBack); CommonEventManager.publishAsUser("event", userId, options, publishCB);
} catch (err) { } catch (err) {
console.error('publishAsUser failed, catch error' + JSON.stringify(err)); console.error('publishAsUser failed, catch error' + JSON.stringify(err));
} }
``` ```
## CommonEventManager.createSubscriber ## CommonEventManager.createSubscriber
createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallback\<CommonEventSubscriber>): void ```ts
createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallback<CommonEventSubscriber>): void
```
Creates a subscriber. This API uses an asynchronous callback to return the result. Creates a subscriber. This API uses an asynchronous callback to return the result.
...@@ -406,15 +231,15 @@ Creates a subscriber. This API uses an asynchronous callback to return the resul ...@@ -406,15 +231,15 @@ Creates a subscriber. This API uses an asynchronous callback to return the resul
```ts ```ts
var subscriber; // Used to save the created subscriber object for subsequent subscription and unsubscription. let subscriber; // Used to save the created subscriber object for subsequent subscription and unsubscription.
// Subscriber information. // Subscriber information.
var subscribeInfo = { let subscribeInfo = {
events: ["event"] events: ["event"]
}; };
// Callback for subscriber creation. // Callback for subscriber creation.
function createSubscriberCallBack(err, commonEventSubscriber) { function createCB(err, commonEventSubscriber) {
if(!err) { if(!err) {
console.info("createSubscriber"); console.info("createSubscriber");
subscriber = commonEventSubscriber; subscriber = commonEventSubscriber;
...@@ -425,17 +250,17 @@ function createSubscriberCallBack(err, commonEventSubscriber) { ...@@ -425,17 +250,17 @@ function createSubscriberCallBack(err, commonEventSubscriber) {
// Create a subscriber. // Create a subscriber.
try { try {
CommonEventManager.createSubscriber(subscribeInfo, createSubscriberCallBack); CommonEventManager.createSubscriber(subscribeInfo, createCB);
} catch (err) { } catch (err) {
console.error('createSubscriber failed, catch error' + JSON.stringify(err)); console.error('createSubscriber failed, catch error' + JSON.stringify(err));
} }
``` ```
## CommonEventManager.createSubscriber ## CommonEventManager.createSubscriber
createSubscriber(subscribeInfo: CommonEventSubscribeInfo): Promise\<CommonEventSubscriber> ```ts
createSubscriber(subscribeInfo: CommonEventSubscribeInfo): Promise<CommonEventSubscriber>
```
Creates a subscriber. This API uses a promise to return the result. Creates a subscriber. This API uses a promise to return the result.
...@@ -455,32 +280,28 @@ Creates a subscriber. This API uses a promise to return the result. ...@@ -455,32 +280,28 @@ Creates a subscriber. This API uses a promise to return the result.
**Example** **Example**
```ts ```ts
var subscriber; // Used to save the created subscriber object for subsequent subscription and unsubscription. let subscriber; // Used to save the created subscriber object for subsequent subscription and unsubscription.
// Subscriber information. // Subscriber information.
var subscribeInfo = { let subscribeInfo = {
events: ["event"] events: ["event"]
}; };
// Create a subscriber. // Create a subscriber.
try { CommonEventManager.createSubscriber(subscribeInfo).then((commonEventSubscriber) => {
CommonEventManager.createSubscriber(subscribeInfo).then((commonEventSubscriber) => {
console.info("createSubscriber"); console.info("createSubscriber");
subscriber = commonEventSubscriber; subscriber = commonEventSubscriber;
}).catch((err) => { }).catch((err) => {
console.error("createSubscriber failed " + JSON.stringify(err)); console.error("createSubscriber failed " + JSON.stringify(err));
}); });
} catch(err) {
console.error('createSubscriber failed, catch error' + JSON.stringify(err));
}
``` ```
## CommonEventManager.subscribe ## CommonEventManager.subscribe
subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback\<CommonEventData>): void ```ts
subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback<CommonEventData>): void
```
Subscribes to common events. This API uses an asynchronous callback to return the result. Subscribes to common events. This API uses an asynchronous callback to return the result.
...@@ -497,15 +318,15 @@ Subscribes to common events. This API uses an asynchronous callback to return th ...@@ -497,15 +318,15 @@ Subscribes to common events. This API uses an asynchronous callback to return th
```ts ```ts
// Subscriber information. // Subscriber information.
var subscriber; // Used to save the created subscriber object for subsequent subscription and unsubscription. let subscriber; // Used to save the created subscriber object for subsequent subscription and unsubscription.
// Subscriber information. // Subscriber information.
var subscribeInfo = { let subscribeInfo = {
events: ["event"] events: ["event"]
}; };
// Callback for common event subscription. // Callback for common event subscription.
function SubscribeCallBack(err, data) { function SubscribeCB(err, data) {
if (err.code) { if (err.code) {
console.error("subscribe failed " + JSON.stringify(err)); console.error("subscribe failed " + JSON.stringify(err));
} else { } else {
...@@ -514,13 +335,12 @@ function SubscribeCallBack(err, data) { ...@@ -514,13 +335,12 @@ function SubscribeCallBack(err, data) {
} }
// Callback for subscriber creation. // Callback for subscriber creation.
function createSubscriberCallBack(err, commonEventSubscriber) { function createCB(err, subscriber) {
if(!err) { if(!err) {
console.info("createSubscriber"); console.info("createSubscriber");
subscriber = commonEventSubscriber;
// Subscribe to a common event. // Subscribe to a common event.
try { try {
CommonEventManager.subscribe(subscriber, SubscribeCallBack); CommonEventManager.subscribe(subscriber, SubscribeCB);
} catch (err) { } catch (err) {
console.error("createSubscriber failed " + JSON.stringify(err)); console.error("createSubscriber failed " + JSON.stringify(err));
} }
...@@ -531,17 +351,17 @@ function createSubscriberCallBack(err, commonEventSubscriber) { ...@@ -531,17 +351,17 @@ function createSubscriberCallBack(err, commonEventSubscriber) {
// Create a subscriber. // Create a subscriber.
try { try {
CommonEventManager.createSubscriber(subscribeInfo, createSubscriberCallBack); CommonEventManager.createSubscriber(subscribeInfo, createCB);
} catch (err) { } catch (err) {
console.error('createSubscriber failed, catch error' + JSON.stringify(err)); console.error('createSubscriber failed, catch error' + JSON.stringify(err));
} }
``` ```
## CommonEventManager.unsubscribe ## CommonEventManager.unsubscribe
unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback\<void>): void ```ts
unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback<void>): void
```
Unsubscribes from common events. This API uses an asynchronous callback to return the result. Unsubscribes from common events. This API uses an asynchronous callback to return the result.
...@@ -557,13 +377,13 @@ Unsubscribes from common events. This API uses an asynchronous callback to retur ...@@ -557,13 +377,13 @@ Unsubscribes from common events. This API uses an asynchronous callback to retur
**Example** **Example**
```ts ```ts
var subscriber; // Used to save the created subscriber object for subsequent subscription and unsubscription. let subscriber; // Used to save the created subscriber object for subsequent subscription and unsubscription.
// Subscriber information. // Subscriber information.
var subscribeInfo = { let subscribeInfo = {
events: ["event"] events: ["event"]
}; };
// Callback for common event subscription. // Callback for common event subscription.
function subscribeCallBack(err, data) { function subscribeCB(err, data) {
if (err) { if (err) {
console.info("subscribe failed " + JSON.stringify(err)); console.info("subscribe failed " + JSON.stringify(err));
} else { } else {
...@@ -571,22 +391,21 @@ function subscribeCallBack(err, data) { ...@@ -571,22 +391,21 @@ function subscribeCallBack(err, data) {
} }
} }
// Callback for subscriber creation. // Callback for subscriber creation.
function createSubscriberCallBack(err, commonEventSubscriber) { function createCB(err, subscriber) {
if (err) { if (err) {
console.info("createSubscriber failed " + JSON.stringify(err)); console.info("createSubscriber failed " + JSON.stringify(err));
} else { } else {
console.info("createSubscriber"); console.info("createSubscriber");
subscriber = commonEventSubscriber;
// Subscribe to a common event. // Subscribe to a common event.
try { try {
CommonEventManager.subscribe(subscriber, subscribeCallBack); CommonEventManager.subscribe(subscriber, subscribeCB);
} catch(err) { } catch(err) {
console.info("subscribe failed " + JSON.stringify(err)); console.info("subscribe failed " + JSON.stringify(err));
} }
} }
} }
// Callback for common event unsubscription. // Callback for common event unsubscription.
function unsubscribeCallBack(err) { function unsubscribeCB(err) {
if (err) { if (err) {
console.info("unsubscribe failed " + JSON.stringify(err)); console.info("unsubscribe failed " + JSON.stringify(err));
} else { } else {
...@@ -595,14 +414,14 @@ function unsubscribeCallBack(err) { ...@@ -595,14 +414,14 @@ function unsubscribeCallBack(err) {
} }
// Create a subscriber. // Create a subscriber.
try { try {
CommonEventManager.createSubscriber(subscribeInfo, createSubscriberCallBack); CommonEventManager.createSubscriber(subscribeInfo, createCB);
} catch (err) { } catch (err) {
console.info("createSubscriber failed " + JSON.stringify(err)); console.info("createSubscriber failed " + JSON.stringify(err));
} }
// Unsubscribe from the common event. // Unsubscribe from the common event.
try { try {
CommonEventManager.unsubscribe(subscriber, unsubscribeCallBack); CommonEventManager.unsubscribe(subscriber, unsubscribeCB);
} catch (err) { } catch (err) {
console.info("unsubscribe failed " + JSON.stringify(err)); console.info("unsubscribe failed " + JSON.stringify(err));
} }
...@@ -612,9 +431,11 @@ try { ...@@ -612,9 +431,11 @@ try {
### getCode ### getCode
getCode(callback: AsyncCallback\<number>): void ```ts
getCode(callback: AsyncCallback<number>): void
```
Obtains the result code of this common event. This API uses an asynchronous callback to return the result. Obtains the code of this common event. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -622,29 +443,31 @@ Obtains the result code of this common event. This API uses an asynchronous call ...@@ -622,29 +443,31 @@ Obtains the result code of this common event. This API uses an asynchronous call
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------ | | -------- | ---------------------- | ---- | ------------------ |
| callback | AsyncCallback\<number> | Yes | Callback used to return the result.| | callback | AsyncCallback\<number\> | Yes | Common event code.|
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for result code obtaining of an ordered common event. // Callback for code obtaining of an ordered common event.
function getCodeCallback(err, Code) { function getCodeCB(err, code) {
if (err.code) { if (err.code) {
console.error("getCode failed " + JSON.stringify(err)); console.error("getCode failed " + JSON.stringify(err));
} else { } else {
console.info("getCode " + JSON.stringify(Code)); console.info("getCode " + JSON.stringify(code));
} }
} }
subscriber.getCode(getCodeCallback); subscriber.getCode(getCodeCB);
``` ```
### getCode ### getCode
getCode(): Promise\<number> ```ts
getCode(): Promise<number>
```
Obtains the result code of this common event. This API uses a promise to return the result. Obtains the code of this common event. This API uses a promise to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -652,15 +475,15 @@ Obtains the result code of this common event. This API uses a promise to return ...@@ -652,15 +475,15 @@ Obtains the result code of this common event. This API uses a promise to return
| Type | Description | | Type | Description |
| ---------------- | -------------------- | | ---------------- | -------------------- |
| Promise\<number> | Promise used to return the result.| | Promise\<number> | Common event code.|
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.getCode().then((Code) => { subscriber.getCode().then((code) => {
console.info("getCode " + JSON.stringify(Code)); console.info("getCode " + JSON.stringify(code));
}).catch((err) => { }).catch((err) => {
console.error("getCode failed " + JSON.stringify(err)); console.error("getCode failed " + JSON.stringify(err));
}); });
...@@ -668,9 +491,11 @@ subscriber.getCode().then((Code) => { ...@@ -668,9 +491,11 @@ subscriber.getCode().then((Code) => {
### setCode ### setCode
setCode(code: number, callback: AsyncCallback\<void>): void ```ts
setCode(code: number, callback: AsyncCallback<void>): void
```
Sets the result code for this common event. This API uses an asynchronous callback to return the result. Sets the code for this common event. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -678,30 +503,32 @@ Sets the result code for this common event. This API uses an asynchronous callba ...@@ -678,30 +503,32 @@ Sets the result code for this common event. This API uses an asynchronous callba
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ---------------------- | | -------- | -------------------- | ---- | ---------------------- |
| code | number | Yes | Result code of the common event. | | code | number | Yes | Common event code. |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result.| | callback | AsyncCallback\<void> | Yes | Callback used to return the result.|
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for result code setting of an ordered common event. // Callback for code setting of an ordered common event.
function setCodeCallback(err) { function setCodeCB(err) {
if (err.code) { if (err.code) {
console.error("setCode failed " + JSON.stringify(err)); console.error("setCode failed " + JSON.stringify(err));
} else { } else {
console.info("setCode"); console.info("setCode");
} }
} }
subscriber.setCode(1, setCodeCallback); subscriber.setCode(1, setCodeCB);
``` ```
### setCode ### setCode
setCode(code: number): Promise\<void> ```ts
setCode(code: number): Promise<void>
```
Sets the result code for this common event. This API uses a promise to return the result. Sets the code for this common event. This API uses a promise to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -709,7 +536,7 @@ Sets the result code for this common event. This API uses a promise to return th ...@@ -709,7 +536,7 @@ Sets the result code for this common event. This API uses a promise to return th
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------ | | ------ | ------ | ---- | ------------------ |
| code | number | Yes | Result code of the common event.| | code | number | Yes | Common event code.|
**Return value** **Return value**
...@@ -720,7 +547,7 @@ Sets the result code for this common event. This API uses a promise to return th ...@@ -720,7 +547,7 @@ Sets the result code for this common event. This API uses a promise to return th
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.setCode(1).then(() => { subscriber.setCode(1).then(() => {
console.info("setCode"); console.info("setCode");
...@@ -731,9 +558,11 @@ subscriber.setCode(1).then(() => { ...@@ -731,9 +558,11 @@ subscriber.setCode(1).then(() => {
### getData ### getData
getData(callback: AsyncCallback\<string>): void ```ts
getData(callback: AsyncCallback<string>): void
```
Obtains the result data of this common event. This API uses an asynchronous callback to return the result. Obtains the data of this common event. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -741,29 +570,31 @@ Obtains the result data of this common event. This API uses an asynchronous call ...@@ -741,29 +570,31 @@ Obtains the result data of this common event. This API uses an asynchronous call
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------------------- | | -------- | ---------------------- | ---- | -------------------- |
| callback | AsyncCallback\<string> | Yes | Callback used to return the result data.| | callback | AsyncCallback\<string> | Yes | Common event data.|
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for result data obtaining of an ordered common event. // Callback for data obtaining of an ordered common event.
function getDataCallback(err, Data) { function getDataCB(err, data) {
if (err.code) { if (err.code) {
console.error("getData failed " + JSON.stringify(err)); console.error("getData failed " + JSON.stringify(err));
} else { } else {
console.info("getData " + JSON.stringify(Data)); console.info("getData " + JSON.stringify(data));
} }
} }
subscriber.getData(getDataCallback); subscriber.getData(getDataCB);
``` ```
### getData ### getData
getData(): Promise\<string> ```ts
getData(): Promise<string>
```
Obtains the result data of this common event. This API uses a promise to return the result. Obtains the data of this common event. This API uses a promise to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -771,15 +602,15 @@ Obtains the result data of this common event. This API uses a promise to return ...@@ -771,15 +602,15 @@ Obtains the result data of this common event. This API uses a promise to return
| Type | Description | | Type | Description |
| ---------------- | ------------------ | | ---------------- | ------------------ |
| Promise\<string> | Promise used to return the result data.| | Promise\<string> | Common event data.|
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.getData().then((Data) => { subscriber.getData().then((data) => {
console.info("getData " + JSON.stringify(Data)); console.info("getData " + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
console.error("getData failed " + JSON.stringify(err)); console.error("getData failed " + JSON.stringify(err));
}); });
...@@ -789,7 +620,7 @@ subscriber.getData().then((Data) => { ...@@ -789,7 +620,7 @@ subscriber.getData().then((Data) => {
setData(data: string, callback: AsyncCallback\<void>): void setData(data: string, callback: AsyncCallback\<void>): void
Sets the result data for this common event. This API uses an asynchronous callback to return the result. Sets the data for this common event. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -797,30 +628,32 @@ Sets the result data for this common event. This API uses an asynchronous callba ...@@ -797,30 +628,32 @@ Sets the result data for this common event. This API uses an asynchronous callba
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | -------------------- | | -------- | -------------------- | ---- | -------------------- |
| data | string | Yes | Result data of the common event. | | data | string | Yes | Common event data. |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result.| | callback | AsyncCallback\<void> | Yes | Callback used to return the result.|
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for result data setting of an ordered common event // Callback for result data setting of an ordered common event
function setDataCallback(err) { function setDataCB(err) {
if (err.code) { if (err.code) {
console.error("setData failed " + JSON.stringify(err)); console.error("setData failed " + JSON.stringify(err));
} else { } else {
console.info("setData"); console.info("setData");
} }
} }
subscriber.setData("publish_data_changed", setDataCallback); subscriber.setData("publish_data_changed", setDataCB);
``` ```
### setData ### setData
setData(data: string): Promise\<void> ```ts
setData(data: string): Promise<void>
```
Sets the result data for this common event. This API uses a promise to return the result. Sets the data for this common event. This API uses a promise to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -828,7 +661,7 @@ Sets the result data for this common event. This API uses a promise to return th ...@@ -828,7 +661,7 @@ Sets the result data for this common event. This API uses a promise to return th
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------- | | ------ | ------ | ---- | -------------------- |
| data | string | Yes | Result data of the common event.| | data | string | Yes | Common event data.|
**Return value** **Return value**
...@@ -839,7 +672,7 @@ Sets the result data for this common event. This API uses a promise to return th ...@@ -839,7 +672,7 @@ Sets the result data for this common event. This API uses a promise to return th
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.setData("publish_data_changed").then(() => { subscriber.setData("publish_data_changed").then(() => {
console.info("setData"); console.info("setData");
...@@ -850,9 +683,11 @@ subscriber.setData("publish_data_changed").then(() => { ...@@ -850,9 +683,11 @@ subscriber.setData("publish_data_changed").then(() => {
### setCodeAndData ### setCodeAndData
setCodeAndData(code: number, data: string, callback:AsyncCallback\<void>): void ```ts
setCodeAndData(code: number, data: string, callback:AsyncCallback<void>): void
```
Sets the result code and result data for this common event. This API uses an asynchronous callback to return the result. Sets the code and data for this common event. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -860,31 +695,33 @@ Sets the result code and result data for this common event. This API uses an asy ...@@ -860,31 +695,33 @@ Sets the result code and result data for this common event. This API uses an asy
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ---------------------- | | -------- | -------------------- | ---- | ---------------------- |
| code | number | Yes | Result code of the common event. | | code | number | Yes | Common event code. |
| data | string | Yes | Result data of the common event. | | data | string | Yes | Common event data. |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result.| | callback | AsyncCallback\<void> | Yes | Callback used to return the result.|
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for result code and result data setting of an ordered common event. // Callback for code and data setting of an ordered common event.
function setCodeDataCallback(err) { function setCodeDataCB(err) {
if (err.code) { if (err.code) {
console.error("setCodeAndData failed " + JSON.stringify(err)); console.error("setCodeAndData failed " + JSON.stringify(err));
} else { } else {
console.info("setCodeDataCallback"); console.info("setCodeDataCallback");
} }
} }
subscriber.setCodeAndData(1, "publish_data_changed", setCodeDataCallback); subscriber.setCodeAndData(1, "publish_data_changed", setCodeDataCB);
``` ```
### setCodeAndData ### setCodeAndData
setCodeAndData(code: number, data: string): Promise\<void> ```ts
setCodeAndData(code: number, data: string): Promise<void>
```
Sets the result code and result data for this common event. This API uses a promise to return the result. Sets the code and data for this common event. This API uses a promise to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -892,8 +729,8 @@ Sets the result code and result data for this common event. This API uses a prom ...@@ -892,8 +729,8 @@ Sets the result code and result data for this common event. This API uses a prom
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------- | | ------ | ------ | ---- | -------------------- |
| code | number | Yes | Result code of the common event.| | code | number | Yes | Common event code.|
| data | string | Yes | Result data of the common event.| | data | string | Yes | Common event data.|
**Return value** **Return value**
...@@ -904,7 +741,7 @@ Sets the result code and result data for this common event. This API uses a prom ...@@ -904,7 +741,7 @@ Sets the result code and result data for this common event. This API uses a prom
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.setCodeAndData(1, "publish_data_changed").then(() => { subscriber.setCodeAndData(1, "publish_data_changed").then(() => {
console.info("setCodeAndData"); console.info("setCodeAndData");
...@@ -915,12 +752,12 @@ subscriber.setCodeAndData(1, "publish_data_changed").then(() => { ...@@ -915,12 +752,12 @@ subscriber.setCodeAndData(1, "publish_data_changed").then(() => {
### isOrderedCommonEvent ### isOrderedCommonEvent
isOrderedCommonEvent(callback: AsyncCallback\<boolean>): void ```ts
isOrderedCommonEvent(callback: AsyncCallback<boolean>): void
```
Checks whether this common event is an ordered one. This API uses an asynchronous callback to return the result. Checks whether this common event is an ordered one. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
**Parameters** **Parameters**
...@@ -932,28 +769,28 @@ Checks whether this common event is an ordered one. This API uses an asynchronou ...@@ -932,28 +769,28 @@ Checks whether this common event is an ordered one. This API uses an asynchronou
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for checking whether the current common event is an ordered one. // Callback for checking whether the current common event is an ordered one.
function isOrderedCallback(err, isOrdered) { function isOrderedCB(err, isOrdered) {
if (err.code) { if (err.code) {
console.error("isOrderedCommonEvent failed " + JSON.stringify(err)); console.error("isOrderedCommonEvent failed " + JSON.stringify(err));
} else { } else {
console.info("isOrdered " + JSON.stringify(isOrdered)); console.info("isOrdered " + JSON.stringify(isOrdered));
} }
} }
subscriber.isOrderedCommonEvent(isOrderedCallback); subscriber.isOrderedCommonEvent(isOrderedCB);
``` ```
### isOrderedCommonEvent ### isOrderedCommonEvent
isOrderedCommonEvent(): Promise\<boolean> ```ts
isOrderedCommonEvent(): Promise<boolean>
```
Checks whether this common event is an ordered one. This API uses a promise to return the result. Checks whether this common event is an ordered one. This API uses a promise to return the result.
**System capability**: SystemCapability.Notification.CommonEvent
**System capability**: SystemCapability.Notification.CommonEvent
**Return value** **Return value**
...@@ -964,7 +801,7 @@ Checks whether this common event is an ordered one. This API uses a promise to r ...@@ -964,7 +801,7 @@ Checks whether this common event is an ordered one. This API uses a promise to r
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.isOrderedCommonEvent().then((isOrdered) => { subscriber.isOrderedCommonEvent().then((isOrdered) => {
console.info("isOrdered " + JSON.stringify(isOrdered)); console.info("isOrdered " + JSON.stringify(isOrdered));
...@@ -975,11 +812,11 @@ subscriber.isOrderedCommonEvent().then((isOrdered) => { ...@@ -975,11 +812,11 @@ subscriber.isOrderedCommonEvent().then((isOrdered) => {
### isStickyCommonEvent ### isStickyCommonEvent
isStickyCommonEvent(callback: AsyncCallback\<boolean>): void ```ts
isStickyCommonEvent(callback: AsyncCallback<boolean>): void
Checks whether this common event is a sticky one. This API uses an asynchronous callback to return the result. ```
Checks whether this common event is a sticky one. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -992,27 +829,27 @@ Checks whether this common event is a sticky one. This API uses an asynchronous ...@@ -992,27 +829,27 @@ Checks whether this common event is a sticky one. This API uses an asynchronous
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for checking whether the current common event is a sticky one. // Callback for checking whether the current common event is a sticky one.
function isStickyCallback(err, isSticky) { function isStickyCB(err, isSticky) {
if (err.code) { if (err.code) {
console.error("isStickyCommonEvent failed " + JSON.stringify(err)); console.error("isStickyCommonEvent failed " + JSON.stringify(err));
} else { } else {
console.info("isSticky " + JSON.stringify(isSticky)); console.info("isSticky " + JSON.stringify(isSticky));
} }
} }
subscriber.isStickyCommonEvent(isStickyCallback); subscriber.isStickyCommonEvent(isStickyCB);
``` ```
### isStickyCommonEvent ### isStickyCommonEvent
isStickyCommonEvent(): Promise\<boolean> ```ts
isStickyCommonEvent(): Promise<boolean>
```
Checks whether this common event is a sticky one. This API uses a promise to return the result. Checks whether this common event is a sticky one. This API uses a promise to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
**Return value** **Return value**
...@@ -1024,7 +861,7 @@ Checks whether this common event is a sticky one. This API uses a promise to ret ...@@ -1024,7 +861,7 @@ Checks whether this common event is a sticky one. This API uses a promise to ret
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.isStickyCommonEvent().then((isSticky) => { subscriber.isStickyCommonEvent().then((isSticky) => {
console.info("isSticky " + JSON.stringify(isSticky)); console.info("isSticky " + JSON.stringify(isSticky));
...@@ -1035,7 +872,9 @@ subscriber.isStickyCommonEvent().then((isSticky) => { ...@@ -1035,7 +872,9 @@ subscriber.isStickyCommonEvent().then((isSticky) => {
### abortCommonEvent ### abortCommonEvent
abortCommonEvent(callback: AsyncCallback\<void>): void ```ts
abortCommonEvent(callback: AsyncCallback<void>): void
```
Aborts this common event. After the abort, the common event is not sent to the next subscriber. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result. Aborts this common event. After the abort, the common event is not sent to the next subscriber. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result.
...@@ -1050,22 +889,24 @@ Aborts this common event. After the abort, the common event is not sent to the n ...@@ -1050,22 +889,24 @@ Aborts this common event. After the abort, the common event is not sent to the n
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for common event aborting. // Callback for common event aborting.
function abortCallback(err) { function abortCB(err) {
if (err.code) { if (err.code) {
console.error("abortCommonEvent failed " + JSON.stringify(err)); console.error("abortCommonEvent failed " + JSON.stringify(err));
} else { } else {
console.info("abortCommonEvent"); console.info("abortCommonEvent");
} }
} }
subscriber.abortCommonEvent(abortCallback); subscriber.abortCommonEvent(abortCB);
``` ```
### abortCommonEvent ### abortCommonEvent
abortCommonEvent(): Promise\<void> ```ts
abortCommonEvent(): Promise<void>
```
Aborts this common event. After the abort, the common event is not sent to the next subscriber. This API takes effect only for ordered common events. It uses a promise to return the result. Aborts this common event. After the abort, the common event is not sent to the next subscriber. This API takes effect only for ordered common events. It uses a promise to return the result.
...@@ -1080,7 +921,7 @@ Aborts this common event. After the abort, the common event is not sent to the n ...@@ -1080,7 +921,7 @@ Aborts this common event. After the abort, the common event is not sent to the n
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.abortCommonEvent().then(() => { subscriber.abortCommonEvent().then(() => {
console.info("abortCommonEvent"); console.info("abortCommonEvent");
...@@ -1091,7 +932,9 @@ subscriber.abortCommonEvent().then(() => { ...@@ -1091,7 +932,9 @@ subscriber.abortCommonEvent().then(() => {
### clearAbortCommonEvent ### clearAbortCommonEvent
clearAbortCommonEvent(callback: AsyncCallback\<void>): void ```ts
clearAbortCommonEvent(callback: AsyncCallback<void>): void
```
Clears the aborted state of this common event. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result. Clears the aborted state of this common event. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result.
...@@ -1106,22 +949,24 @@ Clears the aborted state of this common event. This API takes effect only for or ...@@ -1106,22 +949,24 @@ Clears the aborted state of this common event. This API takes effect only for or
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for clearing the aborted state of the current common event. // Callback for clearing the aborted state of the current common event.
function clearAbortCallback(err) { function clearAbortCB(err) {
if (err.code) { if (err.code) {
console.error("clearAbortCommonEvent failed " + JSON.stringify(err)); console.error("clearAbortCommonEvent failed " + JSON.stringify(err));
} else { } else {
console.info("clearAbortCommonEvent"); console.info("clearAbortCommonEvent");
} }
} }
subscriber.clearAbortCommonEvent(clearAbortCallback); subscriber.clearAbortCommonEvent(clearAbortCB);
``` ```
### clearAbortCommonEvent ### clearAbortCommonEvent
clearAbortCommonEvent(): Promise\<void> ```ts
clearAbortCommonEvent(): Promise<void>
```
Clears the aborted state of this common event. This API takes effect only for ordered common events. It uses a promise to return the result. Clears the aborted state of this common event. This API takes effect only for ordered common events. It uses a promise to return the result.
...@@ -1136,7 +981,7 @@ Clears the aborted state of this common event. This API takes effect only for or ...@@ -1136,7 +981,7 @@ Clears the aborted state of this common event. This API takes effect only for or
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.clearAbortCommonEvent().then(() => { subscriber.clearAbortCommonEvent().then(() => {
console.info("clearAbortCommonEvent"); console.info("clearAbortCommonEvent");
...@@ -1147,7 +992,9 @@ subscriber.clearAbortCommonEvent().then(() => { ...@@ -1147,7 +992,9 @@ subscriber.clearAbortCommonEvent().then(() => {
### getAbortCommonEvent ### getAbortCommonEvent
getAbortCommonEvent(callback: AsyncCallback\<boolean>): void ```ts
getAbortCommonEvent(callback: AsyncCallback<boolean>): void
```
Checks whether this common event is in the aborted state. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result. Checks whether this common event is in the aborted state. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result.
...@@ -1162,22 +1009,24 @@ Checks whether this common event is in the aborted state. This API takes effect ...@@ -1162,22 +1009,24 @@ Checks whether this common event is in the aborted state. This API takes effect
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for checking whether the current common event is in the aborted state. // Callback for checking whether the current common event is in the aborted state.
function getAbortCallback(err, AbortCommonEvent) { function getAbortCB(err, abortEvent) {
if (err.code) { if (err.code) {
console.error("getAbortCommonEvent failed " + JSON.stringify(err)); console.error("getAbortCommonEvent failed " + JSON.stringify(err));
} else { } else {
console.info("AbortCommonEvent " + AbortCommonEvent) console.info("abortCommonEvent " + abortEvent)
} }
} }
subscriber.getAbortCommonEvent(getAbortCallback); subscriber.getAbortCommonEvent(getAbortCB);
``` ```
### getAbortCommonEvent ### getAbortCommonEvent
getAbortCommonEvent(): Promise\<boolean> ```ts
getAbortCommonEvent(): Promise<boolean>
```
Checks whether this common event is in the aborted state. This API takes effect only for ordered common events. It uses a promise to return the result. Checks whether this common event is in the aborted state. This API takes effect only for ordered common events. It uses a promise to return the result.
...@@ -1192,10 +1041,10 @@ Checks whether this common event is in the aborted state. This API takes effect ...@@ -1192,10 +1041,10 @@ Checks whether this common event is in the aborted state. This API takes effect
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.getAbortCommonEvent().then((AbortCommonEvent) => { subscriber.getAbortCommonEvent().then((abortEvent) => {
console.info("AbortCommonEvent " + JSON.stringify(AbortCommonEvent)); console.info("abortCommonEvent " + JSON.stringify(abortEvent));
}).catch((err) => { }).catch((err) => {
console.error("getAbortCommonEvent failed " + JSON.stringify(err)); console.error("getAbortCommonEvent failed " + JSON.stringify(err));
}); });
...@@ -1203,7 +1052,9 @@ subscriber.getAbortCommonEvent().then((AbortCommonEvent) => { ...@@ -1203,7 +1052,9 @@ subscriber.getAbortCommonEvent().then((AbortCommonEvent) => {
### getSubscribeInfo ### getSubscribeInfo
getSubscribeInfo(callback: AsyncCallback\<CommonEventSubscribeInfo>): void ```ts
getSubscribeInfo(callback: AsyncCallback<CommonEventSubscribeInfo>): void
```
Obtains the subscriber information. This API uses an asynchronous callback to return the result. Obtains the subscriber information. This API uses an asynchronous callback to return the result.
...@@ -1218,22 +1069,24 @@ Obtains the subscriber information. This API uses an asynchronous callback to re ...@@ -1218,22 +1069,24 @@ Obtains the subscriber information. This API uses an asynchronous callback to re
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for subscriber information obtaining. // Callback for subscriber information obtaining.
function getSubscribeInfoCallback(err, SubscribeInfo) { function getCB(err, subscribeInfo) {
if (err.code) { if (err.code) {
console.error("getSubscribeInfo failed " + JSON.stringify(err)); console.error("getSubscribeInfo failed " + JSON.stringify(err));
} else { } else {
console.info("SubscribeInfo " + JSON.stringify(SubscribeInfo)); console.info("subscribeInfo " + JSON.stringify(subscribeInfo));
} }
} }
subscriber.getSubscribeInfo(getSubscribeInfoCallback); subscriber.getSubscribeInfo(getCB);
``` ```
### getSubscribeInfo ### getSubscribeInfo
getSubscribeInfo(): Promise\<CommonEventSubscribeInfo> ```ts
getSubscribeInfo(): Promise<CommonEventSubscribeInfo>
```
Obtains the subscriber information. This API uses a promise to return the result. Obtains the subscriber information. This API uses a promise to return the result.
...@@ -1248,10 +1101,10 @@ Obtains the subscriber information. This API uses a promise to return the result ...@@ -1248,10 +1101,10 @@ Obtains the subscriber information. This API uses a promise to return the result
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.getSubscribeInfo().then((SubscribeInfo) => { subscriber.getSubscribeInfo().then((subscribeInfo) => {
console.info("SubscribeInfo " + JSON.stringify(SubscribeInfo)); console.info("subscribeInfo " + JSON.stringify(subscribeInfo));
}).catch((err) => { }).catch((err) => {
console.error("getSubscribeInfo failed " + JSON.stringify(err)); console.error("getSubscribeInfo failed " + JSON.stringify(err));
}); });
...@@ -1259,9 +1112,11 @@ subscriber.getSubscribeInfo().then((SubscribeInfo) => { ...@@ -1259,9 +1112,11 @@ subscriber.getSubscribeInfo().then((SubscribeInfo) => {
### finishCommonEvent<sup>9+</sup> ### finishCommonEvent<sup>9+</sup>
finishCommonEvent(callback: AsyncCallback\<void\>): void ```ts
finishCommonEvent(callback: AsyncCallback<void>): void
```
Finishes this ordered common event. This API uses an asynchronous callback to return the result. Finishes this common event. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -1274,24 +1129,26 @@ Finishes this ordered common event. This API uses an asynchronous callback to re ...@@ -1274,24 +1129,26 @@ Finishes this ordered common event. This API uses an asynchronous callback to re
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
// Callback for ordered common event finishing. // Callback for ordered common event finishing.
function finishCommonEventCallback(err) { function finishCB(err) {
if (err.code) { if (err.code) {
console.error("finishCommonEvent failed " + JSON.stringify(err)); console.error("finishCommonEvent failed " + JSON.stringify(err));
} else { } else {
console.info("FinishCommonEvent"); console.info("FinishCommonEvent");
} }
} }
subscriber.finishCommonEvent(finishCommonEventCallback); subscriber.finishCommonEvent(finishCB);
``` ```
### finishCommonEvent<sup>9+</sup> ### finishCommonEvent<sup>9+</sup>
finishCommonEvent(): Promise\<void\> ```ts
finishCommonEvent(): Promise<void\>
```
Finishes this ordered common event. This API uses a promise to return the result. Finishes this common event. This API takes effect only for ordered common events. It uses a promise to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
...@@ -1304,7 +1161,7 @@ Finishes this ordered common event. This API uses a promise to return the result ...@@ -1304,7 +1161,7 @@ Finishes this ordered common event. This API uses a promise to return the result
**Example** **Example**
```ts ```ts
var subscriber; // Subscriber object successfully created. let subscriber; // Subscriber object successfully created.
subscriber.finishCommonEvent().then(() => { subscriber.finishCommonEvent().then(() => {
console.info("FinishCommonEvent"); console.info("FinishCommonEvent");
...@@ -1321,8 +1178,8 @@ subscriber.finishCommonEvent().then(() => { ...@@ -1321,8 +1178,8 @@ subscriber.finishCommonEvent().then(() => {
| ---------- |-------------------- | ---- | ---- | ------------------------------------------------------- | | ---------- |-------------------- | ---- | ---- | ------------------------------------------------------- |
| event | string | Yes | No | Name of the common event that is being received. | | event | string | Yes | No | Name of the common event that is being received. |
| bundleName | string | Yes | No | Bundle name. | | bundleName | string | Yes | No | Bundle name. |
| code | number | Yes | No | Result code of the common event, which is used to transfer data of the int type. | | code | number | Yes | No | Code of the common event, which is used to transfer data of the int type. |
| data | string | Yes | No | Custom result data of the common event, which is used to transfer data of the string type.| | data | string | Yes | No | Custom data of the common event, which is used to transfer data of the string type.|
| parameters | {[key: string]: any} | Yes | No | Additional information about the common event. | | parameters | {[key: string]: any} | Yes | No | Additional information about the common event. |
...@@ -1333,8 +1190,8 @@ subscriber.finishCommonEvent().then(() => { ...@@ -1333,8 +1190,8 @@ subscriber.finishCommonEvent().then(() => {
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| --------------------- | -------------------- | ---- | ---- | ---------------------------- | | --------------------- | -------------------- | ---- | ---- | ---------------------------- |
| bundleName | string | Yes | No | Bundle name. | | bundleName | string | Yes | No | Bundle name. |
| code | number | Yes | No | Result code of the common event. | | code | number | Yes | No | Code of the common event. |
| data | string | Yes | No | Custom result data of the common event.| | data | string | Yes | No | Custom data of the common event.|
| subscriberPermissions | Array\<string> | Yes | No | Permissions required for subscribers to receive the common event. | | subscriberPermissions | Array\<string> | Yes | No | Permissions required for subscribers to receive the common event. |
| isOrdered | boolean | Yes | No | Whether the common event is an ordered one. | | isOrdered | boolean | Yes | No | Whether the common event is an ordered one. |
| isSticky | boolean | Yes | No | Whether the common event is a sticky one. Only system applications and system services are allowed to send sticky events.| | isSticky | boolean | Yes | No | Whether the common event is a sticky one. Only system applications and system services are allowed to send sticky events.|
......
# @ohos.events.emitter # @ohos.events.emitter (Emitter)
The **Emitter** module provides APIs for sending and processing in-process events, including the APIs for processing events that are subscribed to in persistent or one-shot manner, unsubscribing from events, and emitting events to the event queue. The **Emitter** module provides the capabilities of sending and processing inter- or intra-thread events in a process. You can use the APIs of this module to subscribe to an event in persistent or one-shot manner, unsubscribe from an event, or emit an event to the event queue.
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 7. > 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.
>
> The APIs of this module can be used in the FA model or stage model.
## Modules to Import ## Modules to Import
...@@ -20,16 +22,16 @@ None ...@@ -20,16 +22,16 @@ None
on(event: [InnerEvent](#innerevent), callback: Callback\<[EventData](#eventdata)\>): void on(event: [InnerEvent](#innerevent), callback: Callback\<[EventData](#eventdata)\>): void
Subscribes to an event in persistent manner. This API uses a callback to return the event. Subscribes to an event in persistent manner and executes a callback after the event is received.
**System capability**: SystemCapability.Notification.Emitter **System capability**: SystemCapability.Notification.Emitter
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------------------- | ---- | --------------------------------------- | | -------- | ----------------------------------- | ---- | ------------------------------------------------------ |
| event | [InnerEvent](#innerevent) | Yes | Event to subscribe to in persistent manner. The **EventPriority** settings do not take effect.| | event | [InnerEvent](#innerevent) | Yes | Event to subscribe to in persistent manner. The [EventPriority](#eventpriority) settings do not take effect.|
| callback | Callback\<[EventData](#eventdata)\> | Yes | Callback used to return the event. | | callback | Callback\<[EventData](#eventdata)\> | Yes | Callback to execute after the event is received. |
**Example** **Example**
...@@ -37,26 +39,28 @@ Subscribes to an event in persistent manner. This API uses a callback to return ...@@ -37,26 +39,28 @@ Subscribes to an event in persistent manner. This API uses a callback to return
let innerEvent = { let innerEvent = {
eventId: 1 eventId: 1
}; };
function EmitterCallback(eventData) {
// Execute the callback after receiving the event whose eventId is 1.
function emitterCallback() {
console.info('callback'); console.info('callback');
} }
emitter.on(innerEvent, EmitterCallback); emitter.on(innerEvent, emitterCallback);
``` ```
## emitter.once ## emitter.once
once(event: [InnerEvent](#innerevent), callback: Callback\<[EventData](#eventdata)\>): void once(event: [InnerEvent](#innerevent), callback: Callback\<[EventData](#eventdata)\>): void
Subscribes to an event in one-shot manner and unsubscribes from it after the event callback is received. Subscribes to an event in one-shot manner and unsubscribes from it after the event callback is executed.
**System capability**: SystemCapability.Notification.Emitter **System capability**: SystemCapability.Notification.Emitter
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------------------- | ---- | --------------------------------------- | | -------- | ----------------------------------- | ---- | ------------------------------------------------------------------------------ |
| event | [InnerEvent](#innerevent) | Yes | Event to subscribe to in one-shot manner. The **EventPriority** settings do not take effect.| | event | [InnerEvent](#innerevent) | Yes | Event to subscribe to in one-shot manner. The [EventPriority](#eventpriority) settings do not take effect.|
| callback | Callback\<[EventData](#eventdata)\> | Yes | Callback used to return the event. | | callback | Callback\<[EventData](#eventdata)\> | Yes | Callback to execute after the event is received. |
**Example** **Example**
...@@ -64,10 +68,12 @@ Subscribes to an event in one-shot manner and unsubscribes from it after the eve ...@@ -64,10 +68,12 @@ Subscribes to an event in one-shot manner and unsubscribes from it after the eve
let innerEvent = { let innerEvent = {
eventId: 1 eventId: 1
}; };
function EmitterCallback(eventData) {
// Execute the callback after receiving the event whose eventId is 1.
function emitterCallback() {
console.info('once callback'); console.info('once callback');
}; };
emitter.once(innerEvent, EmitterCallback); emitter.once(innerEvent, emitterCallback);
``` ```
## emitter.off ## emitter.off
...@@ -92,17 +98,17 @@ emitter.off(1); ...@@ -92,17 +98,17 @@ emitter.off(1);
## emitter.emit ## emitter.emit
emit(event: InnerEvent, data?: EventData): void emit(event: [InnerEvent](#innerevent), data?: [EventData](#eventdata)): void
Emits an event to the event queue. Emits an event.
**System capability**: SystemCapability.Notification.Emitter **System capability**: SystemCapability.Notification.Emitter
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------------------------- | ---- | -------------- | | ------ | ------------------------- | ---- | ------------- |
| event | [InnerEvent](#innerevent) | Yes | Event to emit. | | event | [InnerEvent](#innerevent) | Yes | Event to emit, where [EventPriority](#eventpriority) specifies the emit priority of the event.|
| data | [EventData](#eventdata) | No | Data carried by the event.| | data | [EventData](#eventdata) | No | Data carried by the event.|
**Example** **Example**
...@@ -112,11 +118,14 @@ let eventData = { ...@@ -112,11 +118,14 @@ let eventData = {
data: { data: {
"content": "c", "content": "c",
"id": 1, "id": 1,
}}; }
};
let innerEvent = { let innerEvent = {
eventId: 1, eventId: 1,
priority: emitter.EventPriority.HIGH priority: emitter.EventPriority.HIGH
}; };
emitter.emit(innerEvent, eventData); emitter.emit(innerEvent, eventData);
``` ```
...@@ -126,23 +135,23 @@ Enumerates the event emit priority levels. ...@@ -126,23 +135,23 @@ Enumerates the event emit priority levels.
**System capability**: SystemCapability.Notification.Emitter **System capability**: SystemCapability.Notification.Emitter
| Name | Value | Description | | Name | Value | Description |
| --------- | ---- | --------------------------------------------------- | | --------- | ---- | --------------------------------------------------- |
| IMMEDIATE | 0 | The event will be emitted immediately. | | IMMEDIATE | 0 | The event will be emitted immediately. |
| HIGH | 1 | The event will be emitted before low-priority events. | | HIGH | 1 | The event will be emitted before low-priority events. |
| LOW | 2 | The event will be emitted before idle-priority events. By default, an event is in LOW priority.| | LOW | 2 | The event will be emitted before idle-priority events. By default, an event is in LOW priority. |
| IDLE | 3 | The event will be emitted after all the other events. | | IDLE | 3 | The event will be emitted after all the other events. |
## InnerEvent ## InnerEvent
Describes an in-process event. Describes an event to subscribe to or emit. The **EventPriority** settings do not take effect under event subscription.
**System capability**: SystemCapability.Notification.Emitter **System capability**: SystemCapability.Notification.Emitter
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| -------- | ------------------------------- | ---- | ---- | ---------------------------------- | | -------- | ------------------------------- | ---- | ---- | ------------------------------ |
| eventId | number | Yes | Yes | Event ID.| | eventId | number | Yes | Yes | Event ID.|
| priority | [EventPriority](#eventpriority) | Yes | Yes | Emit priority of the event. | | priority | [EventPriority](#eventpriority) | Yes | Yes | Emit priority of the event. |
## EventData ## EventData
......
...@@ -3,125 +3,160 @@ ...@@ -3,125 +3,160 @@
## 1500001 Want Action Is Null ## 1500001 Want Action Is Null
**Error Message** **Error Message**
Want action is null Want action is null
**Description** **Description**
This error code is reported when the **Action** attribute in the **want** is null for the event to send.
This error code is reported when the **Action** attribute in the **want** object is null for the event to send.
**Possible Causes** **Possible Causes**
The **Action** attribute in the **want** is null for the event to send.
The **Action** attribute in the **want** object is null for the event to send.
**Solution** **Solution**
Make sure the **Action** attribute in the **want** is not null.
Make sure the **Action** attribute in the **want** object is not null.
## 1500002 Failed to Send Common Events from a Sandbox Application ## 1500002 Failed to Send Common Events from a Sandbox Application
**Error Message** **Error Message**
sandbox application can not send common event sandbox application can not send common event
**Description** **Description**
This error code is reported when an attempt is made to send a common event from a sandbox application. This error code is reported when an attempt is made to send a common event from a sandbox application.
**Possible Causes** **Possible Causes**
Common events from a sandbox application are blocked. Common events from a sandbox application are blocked.
**Solution** **Solution**
Check whether the application used to send a common event is a sandbox application. If so, switch to another application. Check whether the application used to send a common event is a sandbox application. If so, switch to another application.
## 1500003 Event Sending Frequency Is Too High ## 1500003 Event Sending Frequency Is Too High
**Error Message** **Error Message**
common event send frequency too high common event send frequency too high
**Description** **Description**
This error code is reported when the application sends common events too frequently. This error code is reported when the application sends common events too frequently.
**Possible Causes** **Possible Causes**
The number of common events sent by the application in a given time frame has reached the maximum. The number of common events sent by the application in a given time frame has reached the maximum.
**Solution** **Solution**
Do not send common events too frequently. Do not send common events too frequently.
## 1500004 Failed to Send System Common Events ## 1500004 Failed to Send System Common Events
**Error Message** **Error Message**
not System services or System app not System services or System app
**Description** **Description**
This error code is reported when the application cannot send system common events. This error code is reported when the application cannot send system common events.
**Possible Causes** **Possible Causes**
The application is not a system application or system service. The application is not a system application or system service.
**Solution** **Solution**
Make sure the application to send system common events is a system application or system service. Make sure the application to send system common events is a system application or system service.
## 1500005 Subscriber Not Found ## 1500005 Subscriber Not Found
**Error Message** **Error Message**
subscriber can not found subscriber can not found
**Description** **Description**
This error code is reported when the subscriber cannot be found. This error code is reported when the subscriber cannot be found.
**Possible Causes** **Possible Causes**
The subscriber is deleted. The subscriber is deleted.
**Solution** **Solution**
Check whether the subscription has already been canceled. If the subscription has been canceled, the subscriber is deleted. Check whether the subscription has already been canceled. If the subscription has been canceled, the subscriber is deleted.
## 1500006 Invalid User ID ## 1500006 Invalid User ID
**Error Message** **Error Message**
usreId is invalid
userId is invalid
**Description** **Description**
This error code is reported when the user ID is invalid. This error code is reported when the user ID is invalid.
**Possible Causes** **Possible Causes**
The user ID is different from the system user ID, or the application is not a system application or subsystem process.
**Solution** The user ID is different from the system user ID, or the application is not a system application or system service.
Check whether the current user ID is the same as the system user ID. If they are different, check whether the application is a system application or subsystem process
**Solution**
1. Make sure the current user ID is the same as the system user ID.
2. Make sure the application is a system application or system service.
## 1500007 Failed to Send a Request Through IPC ## 1500007 Failed to Send a Request Through IPC
**Error Message** **Error Message**
message send error message send error
**Description** **Description**
This error code is reported when the attempt to send a request through IPC fails. This error code is reported when the attempt to send a request through IPC fails.
**Possible Causes** **Possible Causes**
The connection object fails to be created. The connection object fails to be created.
**Solution** **Solution**
Do not set up connections frequently. Try again later. Do not set up connections frequently. Try again later.
## 1500008 Failed to Read Data ## 1500008 Failed to Read Data
**Error Message** **Error Message**
CEMS error CEMS error
**Description** **Description**
This error code is reported when an error occurs on the server. This error code is reported when an error occurs on the server.
**Possible Causes** **Possible Causes**
A service exception occurs when the server processes data. A service exception occurs when the server processes data.
**Solution** **Solution**
Try again later. Try again later.
## 1500009 System Error ## 1500009 System Error
**Error Message** **Error Message**
system error system error
**Description** **Description**
This error code is reported when an exception occurs in the system during service processing, for example, when the current system time fails to be obtained. This error code is reported when an exception occurs in the system during service processing, for example, when the current system time fails to be obtained.
**Possible Causes** **Possible Causes**
A system fault occurs. A system fault occurs.
**Solution** **Solution**
Try again later.
Try again later.
\ No newline at end of file
...@@ -8,11 +8,11 @@ Internal Error. ...@@ -8,11 +8,11 @@ Internal Error.
**Description** **Description**
This error code is reported when an internal processing error occurs, such as a memory allocation or multi-thread processing error. This error code is reported when an internal error occurs, such as a memory allocation or multi-thread processing error.
**Possible Causes** **Possible Causes**
1. Common kernel errors such as memory allocation and multi-thread processing errors occur. A common kernel error, such as a memory allocation or multi-thread processing error, occurs.
**Solution** **Solution**
...@@ -36,8 +36,9 @@ This error code is reported when a serialization or deserialization error occurs ...@@ -36,8 +36,9 @@ This error code is reported when a serialization or deserialization error occurs
**Solution** **Solution**
1. Make sure the input parameter value is within the valid range. 1. Make sure the input parameter value length is within the valid range.
2. Make sure the notification subsystem is not being started. 2. Make sure the input parameter value is valid.
3. Make sure the notification subsystem has been started.
## 1600003 Failed to Connect to the Service ## 1600003 Failed to Connect to the Service
...@@ -47,7 +48,7 @@ Failed to connect to service. ...@@ -47,7 +48,7 @@ Failed to connect to service.
**Description** **Description**
This error code is reported when the notification subsystem is abnormal due to a service connection failure. This error code is reported when the connection with the notification subsystem fails.
**Possible Causes** **Possible Causes**
...@@ -66,15 +67,15 @@ Notification is not enabled. ...@@ -66,15 +67,15 @@ Notification is not enabled.
**Description** **Description**
This error code is reported when the notification function is disabled. This error code is reported when the notification feature is disabled.
**Possible Causes** **Possible Causes**
The notification function is set to its default state (default) or manually disabled. The notification feature is not enabled manually. By default, this feature is disabled.
**Solution** **Solution**
Enable the notification function. Enable the notification feature.
## 1600005 Notification Slot Is Disabled ## 1600005 Notification Slot Is Disabled
...@@ -102,16 +103,16 @@ Notification is not allowed to remove. ...@@ -102,16 +103,16 @@ Notification is not allowed to remove.
**Description** **Description**
This error code is reported when **isUnremoveable** is set to **true** and an attempt is made to remove all notifications or when **isRemoveAllowed** is set to **false** and an attempt is made to remove a specific notification. This error code is reported when the notification removal does not comply with the permission settings.
**Possible Causes** **Possible Causes**
1. When **isUnremoveable** is set to **true**, notifications can only be removed on a one-by-one basis. 1. When **isUnremovable** is set to **true**, notifications can only be removed on a one-by-one basis.
2. When **isRemoveAllowed** is set to **false**, no notification can be deleted. 2. When **isRemoveAllowed** is set to **false**, no notification can be removed.
**Solution** **Solution**
1. Check whether **unremovable** is set to **true**. 1. Check whether **isUnremovable** is set to **true**
2. Check whether **isRemoveAllowed** is set to **false**. 2. Check whether **isRemoveAllowed** is set to **false**.
## 1600007 Notification Not Found ## 1600007 Notification Not Found
...@@ -131,7 +132,7 @@ This error code is reported when the target notification is not found. ...@@ -131,7 +132,7 @@ This error code is reported when the target notification is not found.
**Solution** **Solution**
Make sure the notification exists. 1. Make sure the notification exists.
## 1600008 User Not Found ## 1600008 User Not Found
...@@ -208,7 +209,7 @@ This error code is reported when the template configuration file fails to be rea ...@@ -208,7 +209,7 @@ This error code is reported when the template configuration file fails to be rea
**Solution** **Solution**
1. Check for the **/system/etc/notification_template/external.json** file. 1. Check for the **/system/etc/notification_template/external.json** file.
2. Update the version to 3.2 or later. 2. Update the system version to 3.2 or later.
## 17700001 Bundle Name Not Found ## 17700001 Bundle Name Not Found
...@@ -228,4 +229,5 @@ This error code is reported when the specified bund name is not found. ...@@ -228,4 +229,5 @@ This error code is reported when the specified bund name is not found.
**Solution** **Solution**
1. Verify the bundle name. 1. Verify the bundle name.
2. Make sure the application has been installed.
2. Make sure the application has been installed.
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册