harmony 鸿蒙@system.notification (Notification)
@system.notification (Notification)
NOTE - The APIs of this module are no longer maintained since API version 7. You are advised to use
@ohos.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.
Modules to Import
import notification from '@system.notification';
ActionResult
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. |
ShowNotificationOptions
System capability: SystemCapability.Notification.Notification
Name | Type | Mandatory | Description |
---|---|---|---|
contentTitle | string | No | Notification title. |
contentText | string | No | Notification content. |
clickAction | ActionResult | No | Action triggered when the notification is clicked. |
notification.show
show(options?: ShowNotificationOptions): void
Displays a notification.
System capability: SystemCapability.Notification.Notification
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
options | ShowNotificationOptions | No | Notification title. |
Example
let notificationObj: notification = {
show() {
notification.show({
contentTitle: 'title info',
contentText: 'text',
clickAction: {
bundleName: 'com.example.testapp',
abilityName: 'notificationDemo',
uri: '/path/to/notification'
}
});
}
}
你可能感兴趣的鸿蒙文章
harmony 鸿蒙Notification Kit (User Notification Service)
harmony 鸿蒙Notification Error Codes
harmony 鸿蒙NotificationActionButton
harmony 鸿蒙NotificationCommonDef
harmony 鸿蒙NotificationContent (System API)
0
赞
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦