• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @system.notification (Notification)
2
3> **NOTE**
4> - The APIs of this module are no longer maintained since API version 7. You are advised to use [@ohos.notification](js-apis-notification.md).
5>
6> - 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.
7
8
9## Modules to Import
10
11
12```
13import notification from '@system.notification';
14```
15
16## ActionResult
17
18**System capability**: SystemCapability.Notification.Notification
19
20| Name       | Type                                          | Mandatory| Description                     |
21| ----------- | ---------------------------------------------- | ---- | ------------------------- |
22| bundleName  | string                                          | Yes  | Name of the application bundle to which the notification will be redirected after being clicked.                 |
23| abilityName  | string                                          | Yes  | Name of the application ability to which the notification will be redirected after being clicked.|
24| uri         | string                                          | No  | URI of the page to be redirected to.             |
25
26
27## ShowNotificationOptions
28
29**System capability**: SystemCapability.Notification.Notification
30
31| Name         | Type                                          | Mandatory| Description                       |
32| ------------- | ---------------------------------------------- | ---- | ------------------------- |
33| contentTitle  | string                                          | No  | Notification title.                 |
34| contentText   | string                                          | No  | Notification content.                 |
35| clickAction   | ActionResult                                    | No  | Action triggered when the notification is clicked.    |
36
37
38## notification.show
39
40show(options?: ShowNotificationOptions): void
41
42Displays a notification.
43
44**System capability**: SystemCapability.Notification.Notification
45
46**Parameters**
47
48| Name| Type| Mandatory| Description|
49| -------- | -------- | -------- | -------- |
50| options | ShowNotificationOptions | No| Notification title.|
51
52**Example**
53```javascript
54export default {
55    show() {
56        notification.show({
57            contentTitle: 'title info',
58            contentText: 'text',
59            clickAction: {
60                bundleName: 'com.example.testapp',
61                abilityName: 'notificationDemo',
62                uri: '/path/to/notification'
63            }
64        });
65    }
66}
67```
68