notify
Start from API_LEVEL
3.0
. Please refer to API_LEVEL.
Send notifications to the Watch Notification Center.
info
permission code: device:os.notification
Type
function notify(option: Option): Result
Parameters
Option
Property | Type | Required | DefaultValue | Description | API_LEVEL |
---|---|---|---|---|---|
title | string | Y | - | Notice title text | 3.0 |
content | string | Y | - | Text of the notice | 3.0 |
actions | Array<Action> | Y | - | Custom button arrays | 3.0 |
Action
Property | Type | Required | DefaultValue | Description | API_LEVEL |
---|---|---|---|---|---|
text | string | Y | - | Button Text | 3.0 |
file | string | Y | - | The App Service file to be started | 3.0 |
param | string | N | - | Parameters passed in during file loading | 3.0 |
vibrate | number | N | 0 | Specify the vibration effect when the notification center pops up, 0 - default, 1 - beep, 2 - birdsong, 3 - drumbeat, 4 - gentle, 5 - buzz | 3.0 |
Result
Type | Description |
---|---|
number | The result of the notification delivery, returns 0 for delivery failure, the rest of the result indicates the ID of the notification |
Example
import { notify } from '@zos/notification'