The APIs of this module are no longer maintained since API version 7. You are advised to use @ohos.notification (Notification).
The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
System capability: SystemCapability.Notification.Notification
| Name | Type | Mandatory | Description |
|---|---|---|---|
| bundleName | string | Yes | Name of the application bundle to which the notification will be redirected after being clicked. |
| abilityName | string | Yes | Name of the application ability to which the notification will be redirected after being clicked. |
| uri | string | No | URI of the page to be redirected to. |
System capability: SystemCapability.Notification.Notification
| Name | Type | Mandatory | Description |
|---|---|---|---|
| contentTitle | string | No | Notification title. |
| contentText | string | No | Notification content. |
| clickAction(deprecated) | ActionResult | No | Action triggered when the notification is tapped. This API is deprecated since API version 7. |
show(options?: ShowNotificationOptions): void
Displays a notification.
System capability: SystemCapability.Notification.Notification
Parameters
| Name | Type | Mandatory | Description |
|---|---|---|---|
| options | ShowNotificationOptions | No | Options for displaying the notification, including the notification title, notification content, and the action triggered when the notification is tapped. |
Example
let notificationObj: notification = {
show() {
notification.show({
contentTitle: 'title info',
contentText: 'text',
clickAction: {
bundleName: 'com.example.testapp',
abilityName: 'notificationDemo',
uri: '/path/to/notification'
}
});
}
}