harmony 鸿蒙@system.notification (Notification)

2022-08-09 浏览 (797)

@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

NameTypeMandatoryDescription
bundleNamestringYesName of the application bundle to which the notification will be redirected after being clicked.
abilityNamestringYesName of the application ability to which the notification will be redirected after being clicked.
uristringNoURI of the page to be redirected to.

ShowNotificationOptions

System capability: SystemCapability.Notification.Notification

NameTypeMandatoryDescription
contentTitlestringNoNotification title.
contentTextstringNoNotification content.
clickActionActionResultNoAction triggered when the notification is clicked.

notification.show

show(options?: ShowNotificationOptions): void

Displays a notification.

System capability: SystemCapability.Notification.Notification

Parameters

NameTypeMandatoryDescription
optionsShowNotificationOptionsNoNotification title.

Example

class NotificationClass {
  show: Function
}

let notificationObj: NotificationClass = {
  show() {
    notification.show({
      contentTitle: 'title info',
      contentText: 'text',
      clickAction: {
        bundleName: 'com.example.testapp',
        abilityName: 'notificationDemo',
        uri: '/path/to/notification'
      }
    });
  }
}

export default  notificationObj

你可能感兴趣的鸿蒙文章

harmony 鸿蒙APIs

harmony 鸿蒙System Common Events (To Be Deprecated Soon)

harmony 鸿蒙System Common Events

harmony 鸿蒙API Reference Document Description

harmony 鸿蒙Enterprise Device Management Overview (for System Applications Only)

harmony 鸿蒙BundleStatusCallback

harmony 鸿蒙@ohos.bundle.innerBundleManager (innerBundleManager)

harmony 鸿蒙@ohos.distributedBundle (Distributed Bundle Management)

harmony 鸿蒙@ohos.bundle (Bundle)

harmony 鸿蒙@ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)

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