通知消息
說明:
開發(fā)前請熟悉鴻蒙開發(fā)指導文檔 :[gitee.com/li-shizhen-skin/harmony-os/blob/master/README.md
]
導入模塊
import notification from '@system.notification';
ActionResult
系統(tǒng)能力 :以下各項對應(yīng)的系統(tǒng)能力均為SystemCapability.Notification.Notification
名稱 | 可讀 | 可寫 | 類型 | 必填 | 描述 |
---|---|---|---|---|---|
bundleName | 是 | 是 | string | 是 | 單擊通知后要重定向到的應(yīng)用程序的Bundle名。 |
abilityName | 是 | 是 | string | 是 | 單擊通知后要重定向到的應(yīng)用程序的Ability名稱。 |
uri | 是 | 是 | string | 否 | 要重定向到的頁面的uri。 |
ShowNotificationOptions
系統(tǒng)能力 :以下各項對應(yīng)的系統(tǒng)能力均為SystemCapability.Notification.Notification
名稱 | 可讀 | 可寫 | 類型 | 必填 | 描述 |
---|---|---|---|---|---|
contentTitle | 是 | 是 | string | 否 | 通知標題。 |
contentText | 是 | 是 | string | 否 | 通知內(nèi)容。 |
clickAction | 是 | 是 | ActionResult | 否 | 通知被點擊后觸發(fā)的行為。 |
notification.show
show(options?: ShowNotificationOptions): void
顯示通知。
系統(tǒng)能力: SystemCapability.Notification.Notification
參數(shù):
參數(shù)名 | 類型 | 必填 | 說明 |
---|---|---|---|
options | ShowNotificationOptions | 否 | 通知標題。HarmonyOS與OpenHarmony鴻蒙文檔籽料:mau123789是v直接拿 |
示例:
export default {
show() {
notification.show({
contentTitle: 'title info',
contentText: 'text',
clickAction: {
bundleName: 'com.example.testapp',
abilityName: 'notificationDemo',
uri: '/path/to/notification',
},
});
},
}
;
審核編輯 黃宇
-
鴻蒙
+關(guān)注
關(guān)注
59文章
2542瀏覽量
43832
發(fā)布評論請先 登錄
鴻蒙原生應(yīng)用開發(fā)-ArkTS語言基礎(chǔ)類庫概述
基于ArkTS語言的OpenHarmony APP應(yīng)用開發(fā):自定義通知
HarmonyOS NEXT應(yīng)用開發(fā)-Notification Kit(用戶通知服務(wù))notificationManager.cancel
HarmonyOS NEXT應(yīng)用開發(fā)-Notification Kit(用戶通知服務(wù))notificationManager.cancelAll
HarmonyOS NEXT應(yīng)用開發(fā)-Notification Kit(用戶通知服務(wù))更多系統(tǒng)能力
HarmonyOS NEXT應(yīng)用開發(fā)-Notification Kit(用戶通知服務(wù))通知類型、級別與渠道
HarmonyOS NEXT應(yīng)用開發(fā)-Notification Kit(用戶通知服務(wù))概述與notificationManager.publish
HarmonyOS語言基礎(chǔ)類庫開發(fā)指南上線啦!

鴻蒙語言基礎(chǔ)類庫:system.bluetooth 藍牙

評論