1/* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"), 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { AsyncCallback } from './basic'; 17import { BundleOption as _BundleOption } from './notification/NotificationCommonDef'; 18import { NotificationActionButton as _NotificationActionButton } from './notification/notificationActionButton'; 19import { NotificationBasicContent as _NotificationBasicContent } from './notification/notificationContent'; 20import { NotificationContent as _NotificationContent } from './notification/notificationContent'; 21import { NotificationLongTextContent as _NotificationLongTextContent } from './notification/notificationContent'; 22import { NotificationMultiLineContent as _NotificationMultiLineContent } from './notification/notificationContent'; 23import { NotificationPictureContent as _NotificationPictureContent } from './notification/notificationContent'; 24import { NotificationFlags as _NotificationFlags} from './notification/notificationFlags'; 25import { NotificationFlagStatus as _NotificationFlagStatus } from './notification/notificationFlags'; 26import { NotificationRequest as _NotificationRequest } from './notification/notificationRequest'; 27import { DistributedOptions as _DistributedOptions } from './notification/notificationRequest'; 28import { NotificationSlot as _NotificationSlot } from './notification/notificationSlot'; 29import { NotificationSorting as _NotificationSorting } from './notification/notificationSorting'; 30import { NotificationTemplate as _NotificationTemplate } from './notification/notificationTemplate'; 31import { NotificationUserInput as _NotificationUserInput } from './notification/notificationUserInput'; 32 33/** 34 * Manages notifications. 35 * <p>Generally, only system applications have permissions on notification subscription and unsubscribe. 36 * You can specify the content of a notification to be published and the content is carried by 37 * {@link NotificationRequest}. A notification ID is unique in an application and must be specified 38 * when using {@link NotificationRequest} to carry the notification content. If a notification 39 * with this ID has been published and you need to use this ID to publish another notification, 40 * the original notification will be updated. In addition, the notification ID can be used to cancel 41 * a notification by calling the {@link #cancel(int)} method. 42 * @namespace notificationManager 43 * @syscap SystemCapability.Notification.Notification 44 * @since 9 45 */ 46declare namespace notificationManager { 47 /** 48 * Publishes a notification. 49 * <p>If a notification with the same ID has been published by the current application and has not been deleted, 50 * this method will update the notification. 51 * @param { NotificationRequest } request - notification request 52 * @param { AsyncCallback<void> } callback - The callback of publish. 53 * @throws { BusinessError } 401 - The parameter check failed. 54 * @throws { BusinessError } 1600001 - Internal error. 55 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 56 * @throws { BusinessError } 1600003 - Failed to connect service. 57 * @throws { BusinessError } 1600004 - Notification is not enabled. 58 * @throws { BusinessError } 1600005 - Notification slot is not enabled. 59 * @throws { BusinessError } 1600009 - Over max number notifications per second. 60 * @syscap SystemCapability.Notification.Notification 61 * @since 9 62 */ 63 function publish(request: NotificationRequest, callback: AsyncCallback<void>): void; 64 65 /** 66 * Publishes a notification. 67 * <p>If a notification with the same ID has been published by the current application and has not been deleted, 68 * this method will update the notification. 69 * @param { NotificationRequest } request - notification request 70 * @returns { Promise<void> } The promise returned by the function. 71 * @throws { BusinessError } 401 - The parameter check failed. 72 * @throws { BusinessError } 1600001 - Internal error. 73 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 74 * @throws { BusinessError } 1600003 - Failed to connect service. 75 * @throws { BusinessError } 1600004 - Notification is not enabled. 76 * @throws { BusinessError } 1600005 - Notification slot is not enabled. 77 * @throws { BusinessError } 1600009 - Over max number notifications per second. 78 * @syscap SystemCapability.Notification.Notification 79 * @since 9 80 */ 81 function publish(request: NotificationRequest): Promise<void>; 82 83 /** 84 * Publishes a notification to the specified user. 85 * @permission ohos.permission.NOTIFICATION_CONTROLLER 86 * @param { NotificationRequest } request - a notification. 87 * @param { number } userId - of subscriber receiving the notification. 88 * @param { AsyncCallback<void> } callback - The callback of publish. 89 * @throws { BusinessError } 201 - Permission denied. 90 * @throws { BusinessError } 202 - Not system application to call the interface. 91 * @throws { BusinessError } 401 - The parameter check failed. 92 * @throws { BusinessError } 1600001 - Internal error. 93 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 94 * @throws { BusinessError } 1600003 - Failed to connect service. 95 * @throws { BusinessError } 1600004 - Notification is not enabled. 96 * @throws { BusinessError } 1600005 - Notification slot is not enabled. 97 * @throws { BusinessError } 1600008 - The user is not exist. 98 * @throws { BusinessError } 1600009 - Over max number notifications per second. 99 * @syscap SystemCapability.Notification.Notification 100 * @systemapi 101 * @since 9 102 */ 103 function publish(request: NotificationRequest, userId: number, callback: AsyncCallback<void>): void; 104 105 /** 106 * Publishes a notification to the specified user. 107 * @permission ohos.permission.NOTIFICATION_CONTROLLER 108 * @param { NotificationRequest } request - a notification. 109 * @param { number } userId - of subscriber receiving the notification. 110 * @returns { Promise<void> } The promise returned by the function. 111 * @throws { BusinessError } 201 - Permission denied. 112 * @throws { BusinessError } 202 - Not system application to call the interface. 113 * @throws { BusinessError } 401 - The parameter check failed. 114 * @throws { BusinessError } 1600001 - Internal error. 115 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 116 * @throws { BusinessError } 1600003 - Failed to connect service. 117 * @throws { BusinessError } 1600004 - Notification is not enabled. 118 * @throws { BusinessError } 1600005 - Notification slot is not enabled. 119 * @throws { BusinessError } 1600008 - The user is not exist. 120 * @throws { BusinessError } 1600009 - Over max number notifications per second. 121 * @syscap SystemCapability.Notification.Notification 122 * @systemapi 123 * @since 9 124 */ 125 function publish(request: NotificationRequest, userId: number): Promise<void>; 126 127 /** 128 * Publishes a representative notification. 129 * @permission ohos.permission.NOTIFICATION_CONTROLLER and ohos.permission.NOTIFICATION_AGENT_CONTROLLER 130 * @param { NotificationRequest } request - a notification. 131 * @param { string } representativeBundle - bundle name of the representative 132 * @param { number } userId - userid of the representative 133 * @param { AsyncCallback<void> } callback - The callback of publishAsBundle. 134 * @throws { BusinessError } 201 - Permission denied. 135 * @throws { BusinessError } 202 - Not system application to call the interface. 136 * @throws { BusinessError } 401 - The parameter check failed. 137 * @throws { BusinessError } 1600001 - Internal error. 138 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 139 * @throws { BusinessError } 1600003 - Failed to connect service. 140 * @throws { BusinessError } 1600004 - Notification is not enabled. 141 * @throws { BusinessError } 1600005 - Notification slot is not enabled. 142 * @throws { BusinessError } 1600008 - The user is not exist. 143 * @throws { BusinessError } 1600009 - Over max number notifications per second. 144 * @syscap SystemCapability.Notification.Notification 145 * @systemapi 146 * @since 9 147 */ 148 function publishAsBundle(request: NotificationRequest, representativeBundle: string, userId: number, callback: AsyncCallback<void>): void; 149 150 /** 151 * Publishes a representative notification. 152 * @permission ohos.permission.NOTIFICATION_CONTROLLER and ohos.permission.NOTIFICATION_AGENT_CONTROLLER 153 * @param { NotificationRequest } request - a notification. 154 * @param { string } representativeBundle - bundle name of the representative 155 * @param { number } userId - userid of the representative 156 * @returns { Promise<void> } The promise returned by the function. 157 * @throws { BusinessError } 201 - Permission denied. 158 * @throws { BusinessError } 202 - Not system application to call the interface. 159 * @throws { BusinessError } 401 - The parameter check failed. 160 * @throws { BusinessError } 1600001 - Internal error. 161 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 162 * @throws { BusinessError } 1600003 - Failed to connect service. 163 * @throws { BusinessError } 1600004 - Notification is not enabled. 164 * @throws { BusinessError } 1600005 - Notification slot is not enabled. 165 * @throws { BusinessError } 1600008 - The user is not exist. 166 * @throws { BusinessError } 1600009 - Over max number notifications per second. 167 * @syscap SystemCapability.Notification.Notification 168 * @systemapi 169 * @since 9 170 */ 171 function publishAsBundle(request: NotificationRequest, representativeBundle: string, userId: number): Promise<void>; 172 173 /** 174 * Cancel a notification with the specified ID. 175 * @param { number } id - ID of the notification to cancel, which must be unique in the application. 176 * @param { AsyncCallback<void> } callback - The callback of cancel. 177 * @throws { BusinessError } 401 - The parameter check failed. 178 * @throws { BusinessError } 1600001 - Internal error. 179 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 180 * @throws { BusinessError } 1600003 - Failed to connect service. 181 * @throws { BusinessError } 1600007 - The notification is not exist. 182 * @syscap SystemCapability.Notification.Notification 183 * @since 9 184 */ 185 function cancel(id: number, callback: AsyncCallback<void>): void; 186 187 /** 188 * Cancel a notification with the specified label and ID. 189 * @param { number } id - ID of the notification to cancel, which must be unique in the application. 190 * @param { string }label - Label of the notification to cancel. 191 * @param { AsyncCallback<void> } callback - The callback of cancel. 192 * @throws { BusinessError } 401 - The parameter check failed. 193 * @throws { BusinessError } 1600001 - Internal error. 194 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 195 * @throws { BusinessError } 1600003 - Failed to connect service. 196 * @throws { BusinessError } 1600007 - The notification is not exist. 197 * @syscap SystemCapability.Notification.Notification 198 * @since 9 199 */ 200 function cancel(id: number, label: string, callback: AsyncCallback<void>): void; 201 202 /** 203 * Cancel a notification with the specified label and ID. 204 * @param { number } id - ID of the notification to cancel, which must be unique in the application. 205 * @param { string }label - Label of the notification to cancel. 206 * @returns { Promise<void> } The promise returned by the function. 207 * @throws { BusinessError } 401 - The parameter check failed. 208 * @throws { BusinessError } 1600001 - Internal error. 209 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 210 * @throws { BusinessError } 1600003 - Failed to connect service. 211 * @throws { BusinessError } 1600007 - The notification is not exist. 212 * @syscap SystemCapability.Notification.Notification 213 * @since 9 214 */ 215 function cancel(id: number, label?: string): Promise<void>; 216 217 /** 218 * Cancel a representative notification. 219 * @permission ohos.permission.NOTIFICATION_CONTROLLER and ohos.permission.NOTIFICATION_AGENT_CONTROLLER 220 * @param { number } id - ID of the notification to cancel, which must be unique in the application. 221 * @param { string } representativeBundle - bundle name of the representative. 222 * @param { number } userId - userid of the representative. 223 * @param { AsyncCallback<void> } callback - The callback of cancelAsBundle. 224 * @throws { BusinessError } 201 - Permission denied. 225 * @throws { BusinessError } 202 - Not system application to call the interface. 226 * @throws { BusinessError } 401 - The parameter check failed. 227 * @throws { BusinessError } 1600001 - Internal error. 228 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 229 * @throws { BusinessError } 1600003 - Failed to connect service. 230 * @throws { BusinessError } 1600007 - The notification is not exist. 231 * @throws { BusinessError } 1600008 - The user is not exist. 232 * @syscap SystemCapability.Notification.Notification 233 * @systemapi 234 * @since 9 235 */ 236 function cancelAsBundle(id: number, representativeBundle: string, userId: number, callback: AsyncCallback<void>): void; 237 238 /** 239 * Cancel a representative notification. 240 * @permission ohos.permission.NOTIFICATION_CONTROLLER and ohos.permission.NOTIFICATION_AGENT_CONTROLLER 241 * @param { number } id - ID of the notification to cancel, which must be unique in the application. 242 * @param { string } representativeBundle - bundle name of the representative. 243 * @param { number } userId - userid of the representative. 244 * @returns { Promise<void> } The promise returned by the function. 245 * @throws { BusinessError } 201 - Permission denied. 246 * @throws { BusinessError } 202 - Not system application to call the interface. 247 * @throws { BusinessError } 401 - The parameter check failed. 248 * @throws { BusinessError } 1600001 - Internal error. 249 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 250 * @throws { BusinessError } 1600003 - Failed to connect service. 251 * @throws { BusinessError } 1600007 - The notification is not exist. 252 * @throws { BusinessError } 1600008 - The user is not exist. 253 * @syscap SystemCapability.Notification.Notification 254 * @systemapi 255 * @since 9 256 */ 257 function cancelAsBundle(id: number, representativeBundle: string, userId: number): Promise<void>; 258 259 /** 260 * Cancel all notifications of the current application. 261 * @param { AsyncCallback<void> } callback - The callback of cancelAll. 262 * @throws { BusinessError } 401 - The parameter check failed. 263 * @throws { BusinessError } 1600001 - Internal error. 264 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 265 * @throws { BusinessError } 1600003 - Failed to connect service. 266 * @syscap SystemCapability.Notification.Notification 267 * @since 9 268 */ 269 function cancelAll(callback: AsyncCallback<void>): void; 270 271 /** 272 * Cancel all notifications of the current application. 273 * @returns { Promise<void> } The promise returned by the function. 274 * @throws { BusinessError } 401 - The parameter check failed. 275 * @throws { BusinessError } 1600001 - Internal error. 276 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 277 * @throws { BusinessError } 1600003 - Failed to connect service. 278 * @syscap SystemCapability.Notification.Notification 279 * @since 9 280 */ 281 function cancelAll(): Promise<void>; 282 283 /** 284 * Creates a notification slot. 285 * @permission ohos.permission.NOTIFICATION_CONTROLLER 286 * @param { NotificationSlot } slot - Indicates the notification slot to be created, which is set by {@link NotificationSlot}. 287 * @param { AsyncCallback<void> } callback - The callback of addSlot. 288 * @throws { BusinessError } 201 - Permission denied. 289 * @throws { BusinessError } 202 - Not system application to call the interface. 290 * @throws { BusinessError } 401 - The parameter check failed. 291 * @throws { BusinessError } 1600001 - Internal error. 292 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 293 * @throws { BusinessError } 1600003 - Failed to connect service. 294 * @syscap SystemCapability.Notification.Notification 295 * @systemapi 296 * @since 9 297 */ 298 function addSlot(slot: NotificationSlot, callback: AsyncCallback<void>): void; 299 300 /** 301 * Creates a notification slot. 302 * @permission ohos.permission.NOTIFICATION_CONTROLLER 303 * @param { NotificationSlot } slot - Indicates the notification slot to be created, which is set by {@link NotificationSlot}. 304 * @returns { Promise<void> } The promise returned by the function. 305 * @throws { BusinessError } 201 - Permission denied. 306 * @throws { BusinessError } 202 - Not system application to call the interface. 307 * @throws { BusinessError } 401 - The parameter check failed. 308 * @throws { BusinessError } 1600001 - Internal error. 309 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 310 * @throws { BusinessError } 1600003 - Failed to connect service. 311 * @syscap SystemCapability.Notification.Notification 312 * @systemapi 313 * @since 9 314 */ 315 function addSlot(slot: NotificationSlot): Promise<void>; 316 317 /** 318 * Adds a slot type. 319 * @param { SlotType } type - Slot type to add. 320 * @param { AsyncCallback<void> } callback - The callback of addSlot. 321 * @throws { BusinessError } 401 - The parameter check failed. 322 * @throws { BusinessError } 1600001 - Internal error. 323 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 324 * @throws { BusinessError } 1600003 - Failed to connect service. 325 * @syscap SystemCapability.Notification.Notification 326 * @since 9 327 */ 328 function addSlot(type: SlotType, callback: AsyncCallback<void>): void; 329 330 /** 331 * Adds a slot type. 332 * @param { SlotType } type - Slot type to add. 333 * @returns { Promise<void> } The promise returned by the function. 334 * @throws { BusinessError } 401 - The parameter check failed. 335 * @throws { BusinessError } 1600001 - Internal error. 336 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 337 * @throws { BusinessError } 1600003 - Failed to connect service. 338 * @syscap SystemCapability.Notification.Notification 339 * @since 9 340 */ 341 function addSlot(type: SlotType): Promise<void>; 342 343 /** 344 * Creates a notification slot. 345 * @permission ohos.permission.NOTIFICATION_CONTROLLER 346 * @param { Array<NotificationSlot> } slots - Indicates the notification slots to be created, which is set by {@link NotificationSlot}. 347 * @param { AsyncCallback<void> } callback - The callback of addSlots. 348 * @throws { BusinessError } 201 - Permission denied. 349 * @throws { BusinessError } 202 - Not system application to call the interface. 350 * @throws { BusinessError } 401 - The parameter check failed. 351 * @throws { BusinessError } 1600001 - Internal error. 352 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 353 * @throws { BusinessError } 1600003 - Failed to connect service. 354 * @syscap SystemCapability.Notification.Notification 355 * @systemapi 356 * @since 9 357 */ 358 function addSlots(slots: Array<NotificationSlot>, callback: AsyncCallback<void>): void; 359 360 /** 361 * Creates a notification slot. 362 * @permission ohos.permission.NOTIFICATION_CONTROLLER 363 * @param { Array<NotificationSlot> } slots - Indicates the notification slots to be created, which is set by {@link NotificationSlot}. 364 * @returns { Promise<void> } The promise returned by the function. 365 * @throws { BusinessError } 201 - Permission denied. 366 * @throws { BusinessError } 202 - Not system application to call the interface. 367 * @throws { BusinessError } 401 - The parameter check failed. 368 * @throws { BusinessError } 1600001 - Internal error. 369 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 370 * @throws { BusinessError } 1600003 - Failed to connect service. 371 * @syscap SystemCapability.Notification.Notification 372 * @systemapi 373 * @since 9 374 */ 375 function addSlots(slots: Array<NotificationSlot>): Promise<void>; 376 377 /** 378 * Obtains a notification slot of the specified slot type. 379 * @param { SlotType } slotType - Type of the notification slot to obtain. 380 * @param { AsyncCallback<NotificationSlot> } callback - The callback is used to return the NotificationSlot. 381 * @throws { BusinessError } 401 - The parameter check failed. 382 * @throws { BusinessError } 1600001 - Internal error. 383 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 384 * @throws { BusinessError } 1600003 - Failed to connect service. 385 * @syscap SystemCapability.Notification.Notification 386 * @since 9 387 */ 388 function getSlot(slotType: SlotType, callback: AsyncCallback<NotificationSlot>): void; 389 390 /** 391 * Obtains a notification slot of the specified slot type. 392 * @param { SlotType } slotType - Type of the notification slot to obtain. 393 * @returns { Promise<NotificationSlot> } Returns the NotificationSlot. 394 * @throws { BusinessError } 401 - The parameter check failed. 395 * @throws { BusinessError } 1600001 - Internal error. 396 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 397 * @throws { BusinessError } 1600003 - Failed to connect service. 398 * @syscap SystemCapability.Notification.Notification 399 * @since 9 400 */ 401 function getSlot(slotType: SlotType): Promise<NotificationSlot>; 402 403 /** 404 * Obtains all NotificationSlot objects created by the current application. 405 * @param { AsyncCallback<Array<NotificationSlot>> } callback - The callback is used to return all notification slots of this application. 406 * @throws { BusinessError } 401 - The parameter check failed. 407 * @throws { BusinessError } 1600001 - Internal error. 408 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 409 * @throws { BusinessError } 1600003 - Failed to connect service. 410 * @syscap SystemCapability.Notification.Notification 411 * @since 9 412 */ 413 function getSlots(callback: AsyncCallback<Array<NotificationSlot>>): void; 414 415 /** 416 * Obtains all NotificationSlot objects created by the current application. 417 * @returns { Promise<Array<NotificationSlot>> } Returns all notification slots of this application. 418 * @throws { BusinessError } 401 - The parameter check failed. 419 * @throws { BusinessError } 1600001 - Internal error. 420 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 421 * @throws { BusinessError } 1600003 - Failed to connect service. 422 * @syscap SystemCapability.Notification.Notification 423 * @since 9 424 */ 425 function getSlots(): Promise<Array<NotificationSlot>>; 426 427 /** 428 * Removes a NotificationSlot of the specified SlotType created by the current application. 429 * @param { SlotType } slotType - Type of the NotificationSlot to remove. 430 * @param { AsyncCallback<void> } callback - The callback of removeSlot. 431 * @throws { BusinessError } 401 - The parameter check failed. 432 * @throws { BusinessError } 1600001 - Internal error. 433 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 434 * @throws { BusinessError } 1600003 - Failed to connect service. 435 * @syscap SystemCapability.Notification.Notification 436 * @since 9 437 */ 438 function removeSlot(slotType: SlotType, callback: AsyncCallback<void>): void; 439 440 /** 441 * Removes a NotificationSlot of the specified SlotType created by the current application. 442 * @param { SlotType } slotType - Type of the NotificationSlot to remove. 443 * @returns { Promise<void> } The promise returned by the function. 444 * @throws { BusinessError } 401 - The parameter check failed. 445 * @throws { BusinessError } 1600001 - Internal error. 446 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 447 * @throws { BusinessError } 1600003 - Failed to connect service. 448 * @syscap SystemCapability.Notification.Notification 449 * @since 9 450 */ 451 function removeSlot(slotType: SlotType): Promise<void>; 452 453 /** 454 * Removes all NotificationSlot objects created by the current application. 455 * @param { AsyncCallback<void> } callback - The callback of removeAllSlots. 456 * @throws { BusinessError } 401 - The parameter check failed. 457 * @throws { BusinessError } 1600001 - Internal error. 458 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 459 * @throws { BusinessError } 1600003 - Failed to connect service. 460 * @syscap SystemCapability.Notification.Notification 461 * @since 9 462 */ 463 function removeAllSlots(callback: AsyncCallback<void>): void; 464 465 /** 466 * Removes all NotificationSlot objects created by the current application. 467 * @returns { Promise<void> } The promise returned by the function. 468 * @throws { BusinessError } 401 - The parameter check failed. 469 * @throws { BusinessError } 1600001 - Internal error. 470 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 471 * @throws { BusinessError } 1600003 - Failed to connect service. 472 * @syscap SystemCapability.Notification.Notification 473 * @since 9 474 */ 475 function removeAllSlots(): Promise<void>; 476 477 /** 478 * Set whether the application can send notifications. 479 * @permission ohos.permission.NOTIFICATION_CONTROLLER 480 * @param { BundleOption } bundle - The bundle option. 481 * @param { boolean } enable - Set enable or not. 482 * @param { AsyncCallback<void> } callback - The callback of setNotificationEnable. 483 * @throws { BusinessError } 201 - Permission denied. 484 * @throws { BusinessError } 202 - Not system application to call the interface. 485 * @throws { BusinessError } 401 - The parameter check failed. 486 * @throws { BusinessError } 1600001 - Internal error. 487 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 488 * @throws { BusinessError } 1600003 - Failed to connect service. 489 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 490 * @syscap SystemCapability.Notification.Notification 491 * @systemapi 492 * @since 9 493 */ 494 function setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCallback<void>): void; 495 496 /** 497 * Set whether the application can send notifications. 498 * @permission ohos.permission.NOTIFICATION_CONTROLLER 499 * @param { BundleOption } bundle - The bundle option. 500 * @param { boolean } enable - Set enable or not. 501 * @returns { Promise<void> } The promise returned by the function. 502 * @throws { BusinessError } 201 - Permission denied. 503 * @throws { BusinessError } 202 - Not system application to call the interface. 504 * @throws { BusinessError } 401 - The parameter check failed. 505 * @throws { BusinessError } 1600001 - Internal error. 506 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 507 * @throws { BusinessError } 1600003 - Failed to connect service. 508 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 509 * @syscap SystemCapability.Notification.Notification 510 * @systemapi 511 * @since 9 512 */ 513 function setNotificationEnable(bundle: BundleOption, enable: boolean): Promise<void>; 514 515 /** 516 * Checks whether this application allows to publish notifications. 517 * @permission ohos.permission.NOTIFICATION_CONTROLLER 518 * @param { BundleOption } bundle - The bundle option. 519 * @param { AsyncCallback<boolean> } callback - The callback of isNotificationEnabled. 520 * @throws { BusinessError } 201 - Permission denied. 521 * @throws { BusinessError } 202 - Not system application to call the interface. 522 * @throws { BusinessError } 401 - The parameter check failed. 523 * @throws { BusinessError } 1600001 - Internal error. 524 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 525 * @throws { BusinessError } 1600003 - Failed to connect service. 526 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 527 * @syscap SystemCapability.Notification.Notification 528 * @systemapi 529 * @since 9 530 */ 531 function isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback<boolean>): void; 532 533 /** 534 * Checks whether this application allows to publish notifications. 535 * @permission ohos.permission.NOTIFICATION_CONTROLLER 536 * @param { BundleOption } bundle - The bundle option. 537 * @returns { Promise<boolean> } The promise returned by the function. 538 * @throws { BusinessError } 201 - Permission denied. 539 * @throws { BusinessError } 202 - Not system application to call the interface. 540 * @throws { BusinessError } 401 - The parameter check failed. 541 * @throws { BusinessError } 1600001 - Internal error. 542 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 543 * @throws { BusinessError } 1600003 - Failed to connect service. 544 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 545 * @syscap SystemCapability.Notification.Notification 546 * @systemapi 547 * @since 9 548 */ 549 function isNotificationEnabled(bundle: BundleOption): Promise<boolean>; 550 551 /** 552 * Checks whether this application allows to publish notifications. 553 * @permission ohos.permission.NOTIFICATION_CONTROLLER 554 * @param { AsyncCallback<boolean> } callback - The callback of isNotificationEnabled. 555 * @throws { BusinessError } 201 - Permission denied. 556 * @throws { BusinessError } 202 - Not system application to call the interface. 557 * @throws { BusinessError } 401 - The parameter check failed. 558 * @throws { BusinessError } 1600001 - Internal error. 559 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 560 * @throws { BusinessError } 1600003 - Failed to connect service. 561 * @syscap SystemCapability.Notification.Notification 562 * @systemapi 563 * @since 9 564 */ 565 function isNotificationEnabled(callback: AsyncCallback<boolean>): void; 566 567 /** 568 * Checks whether this application allows to publish notifications. 569 * @permission ohos.permission.NOTIFICATION_CONTROLLER 570 * @returns { Promise<boolean> } The promise returned by the function. 571 * @throws { BusinessError } 201 - Permission denied. 572 * @throws { BusinessError } 202 - Not system application to call the interface. 573 * @throws { BusinessError } 401 - The parameter check failed. 574 * @throws { BusinessError } 1600001 - Internal error. 575 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 576 * @throws { BusinessError } 1600003 - Failed to connect service. 577 * @syscap SystemCapability.Notification.Notification 578 * @systemapi 579 * @since 9 580 */ 581 function isNotificationEnabled(): Promise<boolean>; 582 583 /** 584 * Checks whether this application allows to publish notifications under the user. 585 * @permission ohos.permission.NOTIFICATION_CONTROLLER 586 * @param { number } userId - The userid of the representative. 587 * @param { AsyncCallback<boolean> } callback - The callback of isNotificationEnabled. 588 * @throws { BusinessError } 201 - Permission denied. 589 * @throws { BusinessError } 202 - Not system application to call the interface. 590 * @throws { BusinessError } 401 - The parameter check failed. 591 * @throws { BusinessError } 1600001 - Internal error. 592 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 593 * @throws { BusinessError } 1600003 - Failed to connect service. 594 * @throws { BusinessError } 1600008 - The user is not exist. 595 * @syscap SystemCapability.Notification.Notification 596 * @systemapi 597 * @since 9 598 */ 599 function isNotificationEnabled(userId: number, callback: AsyncCallback<boolean>): void; 600 601 /** 602 * Checks whether this application allows to publish notifications under the user. 603 * @permission ohos.permission.NOTIFICATION_CONTROLLER 604 * @param { number } userId - The userid of the representative. 605 * @returns { Promise<boolean> } The promise returned by the function. 606 * @throws { BusinessError } 201 - Permission denied. 607 * @throws { BusinessError } 202 - Not system application to call the interface. 608 * @throws { BusinessError } 401 - The parameter check failed. 609 * @throws { BusinessError } 1600001 - Internal error. 610 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 611 * @throws { BusinessError } 1600003 - Failed to connect service. 612 * @throws { BusinessError } 1600008 - The user is not exist. 613 * @syscap SystemCapability.Notification.Notification 614 * @systemapi 615 * @since 9 616 */ 617 function isNotificationEnabled(userId: number): Promise<boolean>; 618 619 /** 620 * Sets whether to allow the specified application to show badge. 621 * @permission ohos.permission.NOTIFICATION_CONTROLLER 622 * @param { BundleOption } bundle - The bundle option. 623 * @param { boolean } enable - Set enable or not. 624 * @param { AsyncCallback<void> } callback - The callback of displayBadge. 625 * @throws { BusinessError } 201 - Permission denied. 626 * @throws { BusinessError } 202 - Not system application to call the interface. 627 * @throws { BusinessError } 401 - The parameter check failed. 628 * @throws { BusinessError } 1600001 - Internal error. 629 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 630 * @throws { BusinessError } 1600003 - Failed to connect service. 631 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 632 * @syscap SystemCapability.Notification.Notification 633 * @systemapi 634 * @since 9 635 */ 636 function displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback<void>): void; 637 638 /** 639 * Sets whether to allow the specified application to show badge. 640 * @permission ohos.permission.NOTIFICATION_CONTROLLER 641 * @param { BundleOption } bundle - The bundle option. 642 * @param { boolean } enable - Set enable or not. 643 * @returns { Promise<void> } The promise returned by the function. 644 * @throws { BusinessError } 201 - Permission denied. 645 * @throws { BusinessError } 202 - Not system application to call the interface. 646 * @throws { BusinessError } 401 - The parameter check failed. 647 * @throws { BusinessError } 1600001 - Internal error. 648 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 649 * @throws { BusinessError } 1600003 - Failed to connect service. 650 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 651 * @syscap SystemCapability.Notification.Notification 652 * @systemapi 653 * @since 9 654 */ 655 function displayBadge(bundle: BundleOption, enable: boolean): Promise<void>; 656 657 /** 658 * Obtains the flag that whether to allow the application to show badge. 659 * @permission ohos.permission.NOTIFICATION_CONTROLLER 660 * @param { BundleOption } bundle - The bundle option. 661 * @param { AsyncCallback<boolean> } callback - The callback of isBadgeDisplayed. 662 * @throws { BusinessError } 201 - Permission denied. 663 * @throws { BusinessError } 202 - Not system application to call the interface. 664 * @throws { BusinessError } 401 - The parameter check failed. 665 * @throws { BusinessError } 1600001 - Internal error. 666 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 667 * @throws { BusinessError } 1600003 - Failed to connect service. 668 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 669 * @syscap SystemCapability.Notification.Notification 670 * @systemapi 671 * @since 9 672 */ 673 function isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback<boolean>): void; 674 675 /** 676 * Obtains the flag that whether to allow the application to show badge. 677 * @permission ohos.permission.NOTIFICATION_CONTROLLER 678 * @param { BundleOption } bundle - The bundle option. 679 * @returns { Promise<boolean> } The promise returned by the function. 680 * @throws { BusinessError } 201 - Permission denied. 681 * @throws { BusinessError } 202 - Not system application to call the interface. 682 * @throws { BusinessError } 401 - The parameter check failed. 683 * @throws { BusinessError } 1600001 - Internal error. 684 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 685 * @throws { BusinessError } 1600003 - Failed to connect service. 686 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 687 * @syscap SystemCapability.Notification.Notification 688 * @systemapi 689 * @since 9 690 */ 691 function isBadgeDisplayed(bundle: BundleOption): Promise<boolean>; 692 693 /** 694 * Update all notification slots for the specified bundle. 695 * @permission ohos.permission.NOTIFICATION_CONTROLLER 696 * @param { BundleOption } bundle - The bundle option. 697 * @param { NotificationSlot } slot - Indicates the notification slot. 698 * @param { AsyncCallback<void> } callback - The callback of setSlotByBundle. 699 * @throws { BusinessError } 201 - Permission denied. 700 * @throws { BusinessError } 202 - Not system application to call the interface. 701 * @throws { BusinessError } 401 - The parameter check failed. 702 * @throws { BusinessError } 1600001 - Internal error. 703 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 704 * @throws { BusinessError } 1600003 - Failed to connect service. 705 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 706 * @syscap SystemCapability.Notification.Notification 707 * @systemapi 708 * @since 9 709 */ 710 function setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCallback<void>): void; 711 712 /** 713 * Update all notification slots for the specified bundle. 714 * @permission ohos.permission.NOTIFICATION_CONTROLLER 715 * @param { BundleOption } bundle - The bundle option. 716 * @param { NotificationSlot } slot - Indicates the notification slot. 717 * @returns { Promise<void> } The promise returned by the function. 718 * @throws { BusinessError } 201 - Permission denied. 719 * @throws { BusinessError } 202 - Not system application to call the interface. 720 * @throws { BusinessError } 401 - The parameter check failed. 721 * @throws { BusinessError } 1600001 - Internal error. 722 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 723 * @throws { BusinessError } 1600003 - Failed to connect service. 724 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 725 * @syscap SystemCapability.Notification.Notification 726 * @systemapi 727 * @since 9 728 */ 729 function setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise<void>; 730 731 /** 732 * Obtains all notification slots belonging to the specified bundle. 733 * @permission ohos.permission.NOTIFICATION_CONTROLLER 734 * @param { BundleOption } bundle - The bundle option. 735 * @param { AsyncCallback<Array<NotificationSlot>> } callback - The callback of getSlotsByBundle. 736 * @throws { BusinessError } 201 - Permission denied. 737 * @throws { BusinessError } 202 - Not system application to call the interface. 738 * @throws { BusinessError } 401 - The parameter check failed. 739 * @throws { BusinessError } 1600001 - Internal error. 740 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 741 * @throws { BusinessError } 1600003 - Failed to connect service. 742 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 743 * @syscap SystemCapability.Notification.Notification 744 * @systemapi 745 * @since 9 746 */ 747 function getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback<Array<NotificationSlot>>): void; 748 749 /** 750 * Obtains all notification slots belonging to the specified bundle. 751 * @permission ohos.permission.NOTIFICATION_CONTROLLER 752 * @param { BundleOption } bundle - The bundle option. 753 * @returns { Promise<Array<NotificationSlot>> } The promise returned by the function. 754 * @throws { BusinessError } 201 - Permission denied. 755 * @throws { BusinessError } 202 - Not system application to call the interface. 756 * @throws { BusinessError } 401 - The parameter check failed. 757 * @throws { BusinessError } 1600001 - Internal error. 758 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 759 * @throws { BusinessError } 1600003 - Failed to connect service. 760 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 761 * @syscap SystemCapability.Notification.Notification 762 * @systemapi 763 * @since 9 764 */ 765 function getSlotsByBundle(bundle: BundleOption): Promise<Array<NotificationSlot>>; 766 767 /** 768 * Obtains number of slot. 769 * @permission ohos.permission.NOTIFICATION_CONTROLLER 770 * @param { BundleOption } bundle - The bundle option. 771 * @param { AsyncCallback<number> } callback - The callback of getSlotNumByBundle. 772 * @throws { BusinessError } 201 - Permission denied. 773 * @throws { BusinessError } 202 - Not system application to call the interface. 774 * @throws { BusinessError } 401 - The parameter check failed. 775 * @throws { BusinessError } 1600001 - Internal error. 776 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 777 * @throws { BusinessError } 1600003 - Failed to connect service. 778 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 779 * @syscap SystemCapability.Notification.Notification 780 * @systemapi 781 * @since 9 782 */ 783 function getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback<number>): void; 784 785 /** 786 * Obtains number of slot. 787 * @permission ohos.permission.NOTIFICATION_CONTROLLER 788 * @param { BundleOption } bundle - The bundle option. 789 * @returns { Promise<number> } The promise returned by the function. 790 * @throws { BusinessError } 201 - Permission denied. 791 * @throws { BusinessError } 202 - Not system application to call the interface. 792 * @throws { BusinessError } 401 - The parameter check failed. 793 * @throws { BusinessError } 1600001 - Internal error. 794 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 795 * @throws { BusinessError } 1600003 - Failed to connect service. 796 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 797 * @syscap SystemCapability.Notification.Notification 798 * @systemapi 799 * @since 9 800 */ 801 function getSlotNumByBundle(bundle: BundleOption): Promise<number>; 802 803 /** 804 * Obtains all active notifications in the current system. The caller must have system permissions to 805 * call this method. 806 * @permission ohos.permission.NOTIFICATION_CONTROLLER 807 * @param { AsyncCallback<Array<NotificationRequest>> } callback - The callback of getAllActiveNotifications. 808 * @throws { BusinessError } 201 - Permission denied. 809 * @throws { BusinessError } 202 - Not system application to call the interface. 810 * @throws { BusinessError } 401 - The parameter check failed. 811 * @throws { BusinessError } 1600001 - Internal error. 812 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 813 * @throws { BusinessError } 1600003 - Failed to connect service. 814 * @syscap SystemCapability.Notification.Notification 815 * @systemapi 816 * @since 9 817 */ 818 function getAllActiveNotifications(callback: AsyncCallback<Array<NotificationRequest>>): void; 819 820 /** 821 * Obtains all active notifications in the current system. The caller must have system permissions to 822 * call this method. 823 * @permission ohos.permission.NOTIFICATION_CONTROLLER 824 * @returns { Promise<Array<NotificationRequest>> } The promise returned by the function. 825 * @throws { BusinessError } 201 - Permission denied. 826 * @throws { BusinessError } 202 - Not system application to call the interface. 827 * @throws { BusinessError } 401 - The parameter check failed. 828 * @throws { BusinessError } 1600001 - Internal error. 829 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 830 * @throws { BusinessError } 1600003 - Failed to connect service. 831 * @syscap SystemCapability.Notification.Notification 832 * @systemapi 833 * @since 9 834 */ 835 function getAllActiveNotifications(): Promise<Array<NotificationRequest>>; 836 837 /** 838 * Obtains the number of all active notifications. 839 * @param { AsyncCallback<number> } callback - The callback of getActiveNotificationCount. 840 * @throws { BusinessError } 401 - The parameter check failed. 841 * @throws { BusinessError } 1600001 - Internal error. 842 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 843 * @throws { BusinessError } 1600003 - Failed to connect service. 844 * @syscap SystemCapability.Notification.Notification 845 * @since 9 846 */ 847 function getActiveNotificationCount(callback: AsyncCallback<number>): void; 848 849 /** 850 * Obtains the number of all active notifications. 851 * @returns { Promise<number> } The promise returned by the function. 852 * @throws { BusinessError } 401 - The parameter check failed. 853 * @throws { BusinessError } 1600001 - Internal error. 854 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 855 * @throws { BusinessError } 1600003 - Failed to connect service. 856 * @syscap SystemCapability.Notification.Notification 857 * @since 9 858 */ 859 function getActiveNotificationCount(): Promise<number>; 860 861 /** 862 * Obtains an array of active notifications. 863 * @param { AsyncCallback<Array<NotificationRequest>> } callback - The callback of getActiveNotifications. 864 * @throws { BusinessError } 401 - The parameter check failed. 865 * @throws { BusinessError } 1600001 - Internal error. 866 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 867 * @throws { BusinessError } 1600003 - Failed to connect service. 868 * @syscap SystemCapability.Notification.Notification 869 * @since 9 870 */ 871 function getActiveNotifications(callback: AsyncCallback<Array<NotificationRequest>>): void; 872 873 /** 874 * Obtains an array of active notifications. 875 * @returns { Promise<Array<NotificationRequest>> } The promise returned by the function. 876 * @throws { BusinessError } 401 - The parameter check failed. 877 * @throws { BusinessError } 1600001 - Internal error. 878 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 879 * @throws { BusinessError } 1600003 - Failed to connect service. 880 * @syscap SystemCapability.Notification.Notification 881 * @since 9 882 */ 883 function getActiveNotifications(): Promise<Array<NotificationRequest>>; 884 885 /** 886 * Cancel the notification of a specified group for this application. 887 * @param { string } groupName - The name of the group. 888 * @param { AsyncCallback<void> } callback - The callback of cancelGroup. 889 * @throws { BusinessError } 401 - The parameter check failed. 890 * @throws { BusinessError } 1600001 - Internal error. 891 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 892 * @throws { BusinessError } 1600003 - Failed to connect service. 893 * @syscap SystemCapability.Notification.Notification 894 * @since 9 895 */ 896 function cancelGroup(groupName: string, callback: AsyncCallback<void>): void; 897 898 /** 899 * Cancel the notification of a specified group for this application. 900 * @param { string } groupName - The name of the group. 901 * @returns { Promise<void> } The promise returned by the function. 902 * @throws { BusinessError } 401 - The parameter check failed. 903 * @throws { BusinessError } 1600001 - Internal error. 904 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 905 * @throws { BusinessError } 1600003 - Failed to connect service. 906 * @syscap SystemCapability.Notification.Notification 907 * @since 9 908 */ 909 function cancelGroup(groupName: string): Promise<void>; 910 911 /** 912 * Delete the notification of a specified group for this application. 913 * @permission ohos.permission.NOTIFICATION_CONTROLLER 914 * @param { BundleOption } bundle - The bundle option. 915 * @param { string } groupName - The name of the group. 916 * @param { AsyncCallback<void> } callback - The callback of removeGroupByBundle. 917 * @throws { BusinessError } 201 - Permission denied. 918 * @throws { BusinessError } 202 - Not system application to call the interface. 919 * @throws { BusinessError } 401 - The parameter check failed. 920 * @throws { BusinessError } 1600001 - Internal error. 921 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 922 * @throws { BusinessError } 1600003 - Failed to connect service. 923 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 924 * @syscap SystemCapability.Notification.Notification 925 * @systemapi 926 * @since 9 927 */ 928 function removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback<void>): void; 929 930 /** 931 * Delete the notification of a specified group for this application. 932 * @permission ohos.permission.NOTIFICATION_CONTROLLER 933 * @param { BundleOption } bundle - The bundle option. 934 * @param { string } groupName - The name of the group. 935 * @returns { Promise<void> } The promise returned by the function. 936 * @throws { BusinessError } 201 - Permission denied. 937 * @throws { BusinessError } 202 - Not system application to call the interface. 938 * @throws { BusinessError } 401 - The parameter check failed. 939 * @throws { BusinessError } 1600001 - Internal error. 940 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 941 * @throws { BusinessError } 1600003 - Failed to connect service. 942 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 943 * @syscap SystemCapability.Notification.Notification 944 * @systemapi 945 * @since 9 946 */ 947 function removeGroupByBundle(bundle: BundleOption, groupName: string): Promise<void>; 948 949 /** 950 * Set the Do Not Disturb date. 951 * @permission ohos.permission.NOTIFICATION_CONTROLLER 952 * @param { DoNotDisturbDate } date - The Do Not Disturb date. 953 * @param { AsyncCallback<void> } callback - The callback of setDoNotDisturbDate. 954 * @throws { BusinessError } 201 - Permission denied. 955 * @throws { BusinessError } 202 - Not system application to call the interface. 956 * @throws { BusinessError } 401 - The parameter check failed. 957 * @throws { BusinessError } 1600001 - Internal error. 958 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 959 * @throws { BusinessError } 1600003 - Failed to connect service. 960 * @syscap SystemCapability.Notification.Notification 961 * @systemapi 962 * @since 9 963 */ 964 function setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback<void>): void; 965 966 /** 967 * Set the Do Not Disturb date. 968 * @permission ohos.permission.NOTIFICATION_CONTROLLER 969 * @param { DoNotDisturbDate } date - The Do Not Disturb date. 970 * @returns { Promise<void> } The promise returned by the function. 971 * @throws { BusinessError } 201 - Permission denied. 972 * @throws { BusinessError } 202 - Not system application to call the interface. 973 * @throws { BusinessError } 401 - The parameter check failed. 974 * @throws { BusinessError } 1600001 - Internal error. 975 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 976 * @throws { BusinessError } 1600003 - Failed to connect service. 977 * @syscap SystemCapability.Notification.Notification 978 * @systemapi 979 * @since 9 980 */ 981 function setDoNotDisturbDate(date: DoNotDisturbDate): Promise<void>; 982 983 /** 984 * Set the Do Not Disturb date under the specified user. 985 * @permission ohos.permission.NOTIFICATION_CONTROLLER 986 * @param { DoNotDisturbDate } date - The Do Not Disturb date. 987 * @param { number } userId - The userId. 988 * @param { AsyncCallback<void> } callback - The callback of setDoNotDisturbDate. 989 * @throws { BusinessError } 201 - Permission denied. 990 * @throws { BusinessError } 202 - Not system application to call the interface. 991 * @throws { BusinessError } 401 - The parameter check failed. 992 * @throws { BusinessError } 1600001 - Internal error. 993 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 994 * @throws { BusinessError } 1600003 - Failed to connect service. 995 * @throws { BusinessError } 1600008 - The user is not exist. 996 * @syscap SystemCapability.Notification.Notification 997 * @systemapi 998 * @since 9 999 */ 1000 function setDoNotDisturbDate(date: DoNotDisturbDate, userId: number, callback: AsyncCallback<void>): void; 1001 1002 /** 1003 * Set the Do Not Disturb date under the specified user. 1004 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1005 * @param { DoNotDisturbDate } date - The Do Not Disturb date. 1006 * @param { number } userId - The userId. 1007 * @returns { Promise<void> } The promise returned by the function. 1008 * @throws { BusinessError } 201 - Permission denied. 1009 * @throws { BusinessError } 202 - Not system application to call the interface. 1010 * @throws { BusinessError } 401 - The parameter check failed. 1011 * @throws { BusinessError } 1600001 - Internal error. 1012 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1013 * @throws { BusinessError } 1600003 - Failed to connect service. 1014 * @throws { BusinessError } 1600008 - The user is not exist. 1015 * @syscap SystemCapability.Notification.Notification 1016 * @systemapi 1017 * @since 9 1018 */ 1019 function setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise<void>; 1020 1021 /** 1022 * Obtains the Do Not Disturb date. 1023 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1024 * @param { AsyncCallback<DoNotDisturbDate> } callback - The callback is used to return the Do Not Disturb date. 1025 * @throws { BusinessError } 201 - Permission denied. 1026 * @throws { BusinessError } 202 - Not system application to call the interface. 1027 * @throws { BusinessError } 401 - The parameter check failed. 1028 * @throws { BusinessError } 1600001 - Internal error. 1029 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1030 * @throws { BusinessError } 1600003 - Failed to connect service. 1031 * @syscap SystemCapability.Notification.Notification 1032 * @systemapi 1033 * @since 9 1034 */ 1035 function getDoNotDisturbDate(callback: AsyncCallback<DoNotDisturbDate>): void; 1036 1037 /** 1038 * Obtains the Do Not Disturb date. 1039 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1040 * @returns { Promise<DoNotDisturbDate> } Returns the Do Not Disturb date. 1041 * @throws { BusinessError } 201 - Permission denied. 1042 * @throws { BusinessError } 202 - Not system application to call the interface. 1043 * @throws { BusinessError } 401 - The parameter check failed. 1044 * @throws { BusinessError } 1600001 - Internal error. 1045 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1046 * @throws { BusinessError } 1600003 - Failed to connect service. 1047 * @syscap SystemCapability.Notification.Notification 1048 * @systemapi 1049 * @since 9 1050 */ 1051 function getDoNotDisturbDate(): Promise<DoNotDisturbDate>; 1052 1053 /** 1054 * Obtains the Do Not Disturb date. 1055 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1056 * @param { number } userId - The userId. 1057 * @param { AsyncCallback<DoNotDisturbDate> } callback - The callback is used to return the Do Not Disturb date. 1058 * @throws { BusinessError } 201 - Permission denied. 1059 * @throws { BusinessError } 202 - Not system application to call the interface. 1060 * @throws { BusinessError } 401 - The parameter check failed. 1061 * @throws { BusinessError } 1600001 - Internal error. 1062 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1063 * @throws { BusinessError } 1600003 - Failed to connect service. 1064 * @throws { BusinessError } 1600008 - The user is not exist. 1065 * @syscap SystemCapability.Notification.Notification 1066 * @systemapi 1067 * @since 9 1068 */ 1069 function getDoNotDisturbDate(userId: number, callback: AsyncCallback<DoNotDisturbDate>): void; 1070 1071 /** 1072 * Obtains the Do Not Disturb date. 1073 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1074 * @param { number } userId - The userId. 1075 * @returns { Promise<DoNotDisturbDate> } Returns the Do Not Disturb date. 1076 * @throws { BusinessError } 201 - Permission denied. 1077 * @throws { BusinessError } 202 - Not system application to call the interface. 1078 * @throws { BusinessError } 401 - The parameter check failed. 1079 * @throws { BusinessError } 1600001 - Internal error. 1080 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1081 * @throws { BusinessError } 1600003 - Failed to connect service. 1082 * @throws { BusinessError } 1600008 - The user is not exist. 1083 * @syscap SystemCapability.Notification.Notification 1084 * @systemapi 1085 * @since 9 1086 */ 1087 function getDoNotDisturbDate(userId: number): Promise<DoNotDisturbDate>; 1088 1089 /** 1090 * Obtains whether to support the Do Not Disturb mode. 1091 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1092 * @param { AsyncCallback<boolean> } callback - The callback is used to return whether Do Not Disturb mode is supported. 1093 * @throws { BusinessError } 201 - Permission denied. 1094 * @throws { BusinessError } 202 - Not system application to call the interface. 1095 * @throws { BusinessError } 401 - The parameter check failed. 1096 * @throws { BusinessError } 1600001 - Internal error. 1097 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1098 * @throws { BusinessError } 1600003 - Failed to connect service. 1099 * @syscap SystemCapability.Notification.Notification 1100 * @systemapi 1101 * @since 9 1102 */ 1103 function isSupportDoNotDisturbMode(callback: AsyncCallback<boolean>): void; 1104 1105 /** 1106 * Obtains whether to support the Do Not Disturb mode. 1107 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1108 * @returns { Promise<boolean> } Returns whether Do Not Disturb mode is supported. 1109 * @throws { BusinessError } 201 - Permission denied. 1110 * @throws { BusinessError } 202 - Not system application to call the interface. 1111 * @throws { BusinessError } 401 - The parameter check failed. 1112 * @throws { BusinessError } 1600001 - Internal error. 1113 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1114 * @throws { BusinessError } 1600003 - Failed to connect service. 1115 * @syscap SystemCapability.Notification.Notification 1116 * @systemapi 1117 * @since 9 1118 */ 1119 function isSupportDoNotDisturbMode(): Promise<boolean>; 1120 1121 /** 1122 * Obtains whether the template is supported by the system. 1123 * @param templateName Name of template to be Obtained. 1124 * @param { AsyncCallback<boolean> } callback - The callback is used to return whether the template is supported. 1125 * @throws { BusinessError } 401 - The parameter check failed. 1126 * @throws { BusinessError } 1600001 - Internal error. 1127 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1128 * @throws { BusinessError } 1600003 - Failed to connect service. 1129 * @syscap SystemCapability.Notification.Notification 1130 * @since 9 1131 */ 1132 function isSupportTemplate(templateName: string, callback: AsyncCallback<boolean>): void; 1133 1134 /** 1135 * Obtains whether the template is supported by the system. 1136 * @param templateName Name of template to be Obtained. 1137 * @returns { Promise<boolean> } Returns whether the template is supported. 1138 * @throws { BusinessError } 401 - The parameter check failed. 1139 * @throws { BusinessError } 1600001 - Internal error. 1140 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1141 * @throws { BusinessError } 1600003 - Failed to connect service. 1142 * @syscap SystemCapability.Notification.Notification 1143 * @since 9 1144 */ 1145 function isSupportTemplate(templateName: string): Promise<boolean>; 1146 1147 /** 1148 * Request permission to send notification. 1149 * @param { AsyncCallback<void> } callback - The callback of requestEnableNotification. 1150 * @throws { BusinessError } 401 - The parameter check failed. 1151 * @throws { BusinessError } 1600001 - Internal error. 1152 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1153 * @throws { BusinessError } 1600003 - Failed to connect service. 1154 * @syscap SystemCapability.Notification.Notification 1155 * @since 9 1156 */ 1157 function requestEnableNotification(callback: AsyncCallback<void>): void; 1158 1159 /** 1160 * Request permission to send notification. 1161 * @returns { Promise<void> } The promise returned by the function. 1162 * @throws { BusinessError } 401 - The parameter check failed. 1163 * @throws { BusinessError } 1600001 - Internal error. 1164 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1165 * @throws { BusinessError } 1600003 - Failed to connect service. 1166 * @syscap SystemCapability.Notification.Notification 1167 * @since 9 1168 */ 1169 function requestEnableNotification(): Promise<void>; 1170 1171 /** 1172 * Sets whether the device supports distributed notification. 1173 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1174 * @param { boolean } enable - Set enable or not. 1175 * @param { AsyncCallback<void> } callback - The callback of setDistributedEnable. 1176 * @throws { BusinessError } 201 - Permission denied. 1177 * @throws { BusinessError } 202 - Not system application to call the interface. 1178 * @throws { BusinessError } 401 - The parameter check failed. 1179 * @throws { BusinessError } 1600001 - Internal error. 1180 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1181 * @throws { BusinessError } 1600003 - Failed to connect service. 1182 * @throws { BusinessError } 1600010 - Distributed operation failed. 1183 * @syscap SystemCapability.Notification.Notification 1184 * @systemapi 1185 * @since 9 1186 */ 1187 function setDistributedEnable(enable: boolean, callback: AsyncCallback<void>): void; 1188 1189 /** 1190 * Sets whether the device supports distributed notification. 1191 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1192 * @param { boolean } enable - Set enable or not. 1193 * @returns { Promise<void> } The promise returned by the function. 1194 * @throws { BusinessError } 201 - Permission denied. 1195 * @throws { BusinessError } 202 - Not system application to call the interface. 1196 * @throws { BusinessError } 401 - The parameter check failed. 1197 * @throws { BusinessError } 1600001 - Internal error. 1198 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1199 * @throws { BusinessError } 1600003 - Failed to connect service. 1200 * @throws { BusinessError } 1600010 - Distributed operation failed. 1201 * @syscap SystemCapability.Notification.Notification 1202 * @systemapi 1203 * @since 9 1204 */ 1205 function setDistributedEnable(enable: boolean): Promise<void>; 1206 1207 /** 1208 * Obtains whether the device supports distributed notification. 1209 * @param { AsyncCallback<boolean> } callback - The callback is used to return whether the distributed notification is supported. 1210 * @throws { BusinessError } 401 - The parameter check failed. 1211 * @throws { BusinessError } 1600001 - Internal error. 1212 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1213 * @throws { BusinessError } 1600003 - Failed to connect service. 1214 * @throws { BusinessError } 1600010 - Distributed operation failed. 1215 * @syscap SystemCapability.Notification.Notification 1216 * @since 9 1217 */ 1218 function isDistributedEnabled(callback: AsyncCallback<boolean>): void; 1219 1220 /** 1221 * Obtains whether the device supports distributed notification. 1222 * @returns { Promise<boolean> } Returns whether the distributed notification is supported. 1223 * @throws { BusinessError } 401 - The parameter check failed. 1224 * @throws { BusinessError } 1600001 - Internal error. 1225 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1226 * @throws { BusinessError } 1600003 - Failed to connect service. 1227 * @throws { BusinessError } 1600010 - Distributed operation failed. 1228 * @syscap SystemCapability.Notification.Notification 1229 * @since 9 1230 */ 1231 function isDistributedEnabled(): Promise<boolean>; 1232 1233 /** 1234 * Sets whether an application supports distributed notification. 1235 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1236 * @param { BundleOption } bundle - The bundle option. 1237 * @param { boolean } enable - Set enable or not. 1238 * @param { AsyncCallback<void> } callback - The callback of setDistributedEnableByBundle. 1239 * @throws { BusinessError } 201 - Permission denied. 1240 * @throws { BusinessError } 202 - Not system application to call the interface. 1241 * @throws { BusinessError } 401 - The parameter check failed. 1242 * @throws { BusinessError } 1600001 - Internal error. 1243 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1244 * @throws { BusinessError } 1600003 - Failed to connect service. 1245 * @throws { BusinessError } 1600010 - Distributed operation failed. 1246 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 1247 * @syscap SystemCapability.Notification.Notification 1248 * @systemapi 1249 * @since 9 1250 */ 1251 function setDistributedEnableByBundle(bundle: BundleOption, enable: boolean, callback: AsyncCallback<void>): void; 1252 1253 /** 1254 * Sets whether an application supports distributed notification. 1255 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1256 * @param { BundleOption } bundle - The bundle option. 1257 * @param { boolean } enable - Set enable or not. 1258 * @returns { Promise<void> } The promise returned by the function. 1259 * @throws { BusinessError } 201 - Permission denied. 1260 * @throws { BusinessError } 202 - Not system application to call the interface. 1261 * @throws { BusinessError } 401 - The parameter check failed. 1262 * @throws { BusinessError } 1600001 - Internal error. 1263 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1264 * @throws { BusinessError } 1600003 - Failed to connect service. 1265 * @throws { BusinessError } 1600010 - Distributed operation failed. 1266 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 1267 * @syscap SystemCapability.Notification.Notification 1268 * @systemapi 1269 * @since 9 1270 */ 1271 function setDistributedEnableByBundle(bundle: BundleOption, enable: boolean): Promise<void>; 1272 1273 /** 1274 * Obtains whether an application supports distributed notification. 1275 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1276 * @param { BundleOption } bundle - The bundle option. 1277 * @param { AsyncCallback<boolean> } callback - The callback is used to return whether the distributed notification is supported. 1278 * @throws { BusinessError } 201 - Permission denied. 1279 * @throws { BusinessError } 202 - Not system application to call the interface. 1280 * @throws { BusinessError } 401 - The parameter check failed. 1281 * @throws { BusinessError } 1600001 - Internal error. 1282 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1283 * @throws { BusinessError } 1600003 - Failed to connect service. 1284 * @throws { BusinessError } 1600010 - Distributed operation failed. 1285 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 1286 * @syscap SystemCapability.Notification.Notification 1287 * @systemapi 1288 * @since 9 1289 */ 1290 function isDistributedEnabledByBundle(bundle: BundleOption, callback: AsyncCallback<boolean>): void; 1291 1292 /** 1293 * Obtains whether an application supports distributed notification. 1294 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1295 * @param { BundleOption } bundle - The bundle option. 1296 * @returns { Promise<boolean> } Returns whether the distributed notification is supported. 1297 * @throws { BusinessError } 201 - Permission denied. 1298 * @throws { BusinessError } 202 - Not system application to call the interface. 1299 * @throws { BusinessError } 401 - The parameter check failed. 1300 * @throws { BusinessError } 1600001 - Internal error. 1301 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1302 * @throws { BusinessError } 1600003 - Failed to connect service. 1303 * @throws { BusinessError } 1600010 - Distributed operation failed. 1304 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 1305 * @syscap SystemCapability.Notification.Notification 1306 * @systemapi 1307 * @since 9 1308 */ 1309 function isDistributedEnabledByBundle(bundle: BundleOption): Promise<boolean>; 1310 1311 /** 1312 * Obtains the remind modes of the notification. 1313 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1314 * @param { AsyncCallback<DeviceRemindType> } callback - The callback is used to return the RemindType. 1315 * @throws { BusinessError } 201 - Permission denied. 1316 * @throws { BusinessError } 202 - Not system application to call the interface. 1317 * @throws { BusinessError } 401 - The parameter check failed. 1318 * @throws { BusinessError } 1600001 - Internal error. 1319 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1320 * @throws { BusinessError } 1600003 - Failed to connect service. 1321 * @syscap SystemCapability.Notification.Notification 1322 * @systemapi 1323 * @since 9 1324 */ 1325 function getDeviceRemindType(callback: AsyncCallback<DeviceRemindType>): void; 1326 1327 /** 1328 * Obtains the remind modes of the notification. 1329 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1330 * @returns { Promise<DeviceRemindType> } Returns the RemindType. 1331 * @throws { BusinessError } 201 - Permission denied. 1332 * @throws { BusinessError } 202 - Not system application to call the interface. 1333 * @throws { BusinessError } 401 - The parameter check failed. 1334 * @throws { BusinessError } 1600001 - Internal error. 1335 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1336 * @throws { BusinessError } 1600003 - Failed to connect service. 1337 * @syscap SystemCapability.Notification.Notification 1338 * @systemapi 1339 * @since 9 1340 */ 1341 function getDeviceRemindType(): Promise<DeviceRemindType>; 1342 1343 /** 1344 * Set whether the application slot is enabled. 1345 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1346 * @param { BundleOption } bundle - The bundle option. 1347 * @param { SlotType } type - Type of the notification slot. 1348 * @param { boolean } enable - Set enable or not. 1349 * @param { AsyncCallback<void> } callback - The callback of setNotificationEnableSlot. 1350 * @throws { BusinessError } 201 - Permission denied. 1351 * @throws { BusinessError } 202 - Not system application to call the interface. 1352 * @throws { BusinessError } 401 - The parameter check failed. 1353 * @throws { BusinessError } 1600001 - Internal error. 1354 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1355 * @throws { BusinessError } 1600003 - Failed to connect service. 1356 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 1357 * @syscap SystemCapability.Notification.Notification 1358 * @systemapi 1359 * @since 9 1360 */ 1361 function setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean, callback: AsyncCallback<void>): void; 1362 1363 /** 1364 * Set whether the application slot is enabled. 1365 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1366 * @param { BundleOption } bundle - The bundle option. 1367 * @param { SlotType } type - Type of the notification slot. 1368 * @param { boolean } enable - Set enable or not. 1369 * @returns { Promise<void> } The promise returned by the function. 1370 * @throws { BusinessError } 201 - Permission denied. 1371 * @throws { BusinessError } 202 - Not system application to call the interface. 1372 * @throws { BusinessError } 401 - The parameter check failed. 1373 * @throws { BusinessError } 1600001 - Internal error. 1374 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1375 * @throws { BusinessError } 1600003 - Failed to connect service. 1376 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 1377 * @syscap SystemCapability.Notification.Notification 1378 * @systemapi 1379 * @since 9 1380 */ 1381 function setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean): Promise<void>; 1382 1383 /** 1384 * Obtains whether the application slot is enabled. 1385 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1386 * @param { BundleOption } bundle - The bundle option. 1387 * @param { SlotType } type - Type of the notification slot. 1388 * @param { AsyncCallback<boolean> } callback - The callback is used to return whether the application slot is enabled. 1389 * @throws { BusinessError } 201 - Permission denied. 1390 * @throws { BusinessError } 202 - Not system application to call the interface. 1391 * @throws { BusinessError } 401 - The parameter check failed. 1392 * @throws { BusinessError } 1600001 - Internal error. 1393 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1394 * @throws { BusinessError } 1600003 - Failed to connect service. 1395 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 1396 * @syscap SystemCapability.Notification.Notification 1397 * @systemapi 1398 * @since 9 1399 */ 1400 function isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncCallback<boolean>): void; 1401 1402 /** 1403 * Obtains whether the application slot is enabled. 1404 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1405 * @param { BundleOption } bundle - The bundle option. 1406 * @param { SlotType } type - Type of the notification slot. 1407 * @returns { Promise<boolean> } Returns whether the application slot is enabled. 1408 * @throws { BusinessError } 201 - Permission denied. 1409 * @throws { BusinessError } 202 - Not system application to call the interface. 1410 * @throws { BusinessError } 401 - The parameter check failed. 1411 * @throws { BusinessError } 1600001 - Internal error. 1412 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1413 * @throws { BusinessError } 1600003 - Failed to connect service. 1414 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 1415 * @syscap SystemCapability.Notification.Notification 1416 * @systemapi 1417 * @since 9 1418 */ 1419 function isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise<boolean>; 1420 1421 /** 1422 * Set whether to sync notifications to devices that do not have the app installed. 1423 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1424 * @param { number } userId - The userId. 1425 * @param { boolean } enable - Set enable or not. 1426 * @param { AsyncCallback<void> } callback - The callback of setSyncNotificationEnabledWithoutApp. 1427 * @throws { BusinessError } 201 - Permission denied. 1428 * @throws { BusinessError } 202 - Not system application to call the interface. 1429 * @throws { BusinessError } 401 - The parameter check failed. 1430 * @throws { BusinessError } 1600001 - Internal error. 1431 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1432 * @throws { BusinessError } 1600003 - Failed to connect service. 1433 * @throws { BusinessError } 1600008 - The user is not exist. 1434 * @syscap SystemCapability.Notification.Notification 1435 * @systemapi 1436 * @since 9 1437 */ 1438 function setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean, callback: AsyncCallback<void>): void; 1439 1440 /** 1441 * Set whether to sync notifications to devices that do not have the app installed. 1442 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1443 * @param { number } userId - The userId. 1444 * @param { boolean } enable - Set enable or not. 1445 * @returns { Promise<void> } The promise returned by the function. 1446 * @throws { BusinessError } 201 - Permission denied. 1447 * @throws { BusinessError } 202 - Not system application to call the interface. 1448 * @throws { BusinessError } 401 - The parameter check failed. 1449 * @throws { BusinessError } 1600001 - Internal error. 1450 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1451 * @throws { BusinessError } 1600003 - Failed to connect service. 1452 * @throws { BusinessError } 1600008 - The user is not exist. 1453 * @syscap SystemCapability.Notification.Notification 1454 * @systemapi 1455 * @since 9 1456 */ 1457 function setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean): Promise<void>; 1458 1459 /** 1460 * Obtains whether to sync notifications to devices that do not have the app installed. 1461 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1462 * @param { number } userId - The userId. 1463 * @param { AsyncCallback<boolean> } callback - The callback is used to return whether to sync notifications to devices. 1464 * @throws { BusinessError } 201 - Permission denied. 1465 * @throws { BusinessError } 202 - Not system application to call the interface. 1466 * @throws { BusinessError } 401 - The parameter check failed. 1467 * @throws { BusinessError } 1600001 - Internal error. 1468 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1469 * @throws { BusinessError } 1600003 - Failed to connect service. 1470 * @throws { BusinessError } 1600008 - The user is not exist. 1471 * @syscap SystemCapability.Notification.Notification 1472 * @systemapi 1473 * @since 9 1474 */ 1475 function getSyncNotificationEnabledWithoutApp(userId: number, callback: AsyncCallback<boolean>): void; 1476 1477 /** 1478 * Obtains whether to sync notifications to devices that do not have the app installed. 1479 * @permission ohos.permission.NOTIFICATION_CONTROLLER 1480 * @param { number } userId - The userId. 1481 * @returns { Promise<boolean> } Returns whether to sync notifications to devices. 1482 * @throws { BusinessError } 201 - Permission denied. 1483 * @throws { BusinessError } 202 - Not system application to call the interface. 1484 * @throws { BusinessError } 401 - The parameter check failed. 1485 * @throws { BusinessError } 1600001 - Internal error. 1486 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 1487 * @throws { BusinessError } 1600003 - Failed to connect service. 1488 * @throws { BusinessError } 1600008 - The user is not exist. 1489 * @syscap SystemCapability.Notification.Notification 1490 * @systemapi 1491 * @since 9 1492 */ 1493 function getSyncNotificationEnabledWithoutApp(userId: number): Promise<boolean>; 1494 1495 /** 1496 * Describes NotificationSlot types. 1497 * @enum { number } 1498 * @syscap SystemCapability.Notification.Notification 1499 * @since 9 1500 */ 1501 export enum SlotType { 1502 /** 1503 * NotificationSlot of an unknown type. 1504 */ 1505 UNKNOWN_TYPE = 0, 1506 1507 /** 1508 * NotificationSlot for social communication. 1509 */ 1510 SOCIAL_COMMUNICATION = 1, 1511 1512 /** 1513 * NotificationSlot for service information. 1514 */ 1515 SERVICE_INFORMATION = 2, 1516 1517 /** 1518 * NotificationSlot for content information. 1519 */ 1520 CONTENT_INFORMATION = 3, 1521 1522 /** 1523 * NotificationSlot for other purposes. 1524 */ 1525 OTHER_TYPES = 0xFFFF, 1526 } 1527 1528 /** 1529 * Describes notification content types. 1530 * @enum { number } 1531 * @syscap SystemCapability.Notification.Notification 1532 * @since 9 1533 */ 1534 export enum ContentType { 1535 /** 1536 * Normal text notification. 1537 */ 1538 NOTIFICATION_CONTENT_BASIC_TEXT, 1539 1540 /** 1541 * Long text notification. 1542 */ 1543 NOTIFICATION_CONTENT_LONG_TEXT, 1544 1545 /** 1546 * Picture-attached notification. 1547 */ 1548 NOTIFICATION_CONTENT_PICTURE, 1549 1550 /** 1551 * Conversation notification. 1552 */ 1553 NOTIFICATION_CONTENT_CONVERSATION, 1554 1555 /** 1556 * Multi-line text notification. 1557 */ 1558 NOTIFICATION_CONTENT_MULTILINE, 1559 } 1560 1561 /** 1562 * Indicates the level of the slot 1563 * @enum { number } 1564 * @syscap SystemCapability.Notification.Notification 1565 * @since 9 1566 */ 1567 export enum SlotLevel { 1568 /** 1569 * Indicates that the notification function is disabled. 1570 */ 1571 LEVEL_NONE = 0, 1572 1573 /** 1574 * Indicates that the notification function is enabled but notification 1575 * icons are not displayed in the status bar, with no banner or prompt tone. 1576 */ 1577 LEVEL_MIN = 1, 1578 1579 /** 1580 * Indicates that the notification function is enabled and notification 1581 * icons are displayed in the status bar, with no banner or prompt tone. 1582 */ 1583 LEVEL_LOW = 2, 1584 1585 /** 1586 * Indicates that the notification function is enabled and notification 1587 * icons are displayed in the status bar, with no banner but with a prompt tone. 1588 */ 1589 LEVEL_DEFAULT = 3, 1590 1591 /** 1592 * Indicates that the notification function is enabled and notification 1593 * icons are displayed in the status bar, with a banner and a prompt tone. 1594 */ 1595 LEVEL_HIGH = 4, 1596 } 1597 1598 /** 1599 * The type of the Do Not Disturb. 1600 * @enum { number } 1601 * @syscap SystemCapability.Notification.Notification 1602 * @systemapi 1603 * @since 9 1604 */ 1605 export enum DoNotDisturbType { 1606 /** 1607 * Non do not disturb type notification 1608 */ 1609 TYPE_NONE = 0, 1610 1611 /** 1612 * Execute do not disturb once in the set time period (only watch hours and minutes) 1613 */ 1614 TYPE_ONCE = 1, 1615 1616 /** 1617 * Execute do not disturb every day with a set time period (only watch hours and minutes) 1618 */ 1619 TYPE_DAILY = 2, 1620 1621 /** 1622 * Execute in the set time period (specify the time, month, day and hour) 1623 */ 1624 TYPE_CLEARLY = 3, 1625 } 1626 1627 /** 1628 * Describes a DoNotDisturbDate instance. 1629 * @typedef DoNotDisturbDate 1630 * @syscap SystemCapability.Notification.Notification 1631 * @systemapi 1632 * @since 9 1633 */ 1634 export interface DoNotDisturbDate { 1635 /** 1636 * the type of the Do Not Disturb. 1637 * 1638 */ 1639 type: DoNotDisturbType; 1640 1641 /** 1642 * the start time of the Do Not Disturb. 1643 * 1644 */ 1645 begin: Date; 1646 1647 /** 1648 * the end time of the Do Not Disturb. 1649 * 1650 */ 1651 end: Date; 1652 } 1653 1654 /** 1655 * The remind type of the notification. 1656 * @enum { number } 1657 * @syscap SystemCapability.Notification.Notification 1658 * @systemapi 1659 * @since 9 1660 */ 1661 export enum DeviceRemindType { 1662 /** 1663 * The device is not in use, no reminder 1664 */ 1665 IDLE_DONOT_REMIND = 0, 1666 1667 /** 1668 * The device is not in use, remind 1669 */ 1670 IDLE_REMIND = 1, 1671 1672 /** 1673 * The device is in use, no reminder 1674 */ 1675 ACTIVE_DONOT_REMIND = 2, 1676 1677 /** 1678 * The device is in use, reminder 1679 */ 1680 ACTIVE_REMIND = 3, 1681 } 1682 1683 /** 1684 * Notification source type 1685 * @enum { number } 1686 * @syscap SystemCapability.Notification.Notification 1687 * @systemapi 1688 * @since 9 1689 */ 1690 export enum SourceType { 1691 /** 1692 * General notification 1693 */ 1694 TYPE_NORMAL = 0, 1695 1696 /** 1697 * Continuous notification 1698 */ 1699 TYPE_CONTINUOUS = 1, 1700 1701 /** 1702 * Scheduled notification 1703 */ 1704 TYPE_TIMER = 2, 1705 } 1706 1707 /** 1708 * Describes a bundleOption in a notification. 1709 * @syscap SystemCapability.Notification.Notification 1710 * @since 9 1711 */ 1712 export type BundleOption = _BundleOption 1713 1714 /** 1715 * Describes an action button displayed in a notification. 1716 * @syscap SystemCapability.Notification.Notification 1717 * @since 9 1718 */ 1719 export type NotificationActionButton = _NotificationActionButton 1720 1721 /** 1722 * Describes a normal text notification. 1723 * @syscap SystemCapability.Notification.Notification 1724 * @since 9 1725 */ 1726 export type NotificationBasicContent = _NotificationBasicContent 1727 1728 /** 1729 * Describes notification types. 1730 * @syscap SystemCapability.Notification.Notification 1731 * @since 9 1732 */ 1733 export type NotificationContent = _NotificationContent 1734 1735 /** 1736 * Describes a long text notification. 1737 * @syscap SystemCapability.Notification.Notification 1738 * @since 9 1739 */ 1740 export type NotificationLongTextContent = _NotificationLongTextContent 1741 1742 /** 1743 * Describes a multi-line text notification. 1744 * @syscap SystemCapability.Notification.Notification 1745 * @since 9 1746 */ 1747 export type NotificationMultiLineContent = _NotificationMultiLineContent 1748 1749 /** 1750 * Describes a picture-attached notification. 1751 * @syscap SystemCapability.Notification.Notification 1752 * @since 9 1753 */ 1754 export type NotificationPictureContent = _NotificationPictureContent 1755 1756 /** 1757 * Describes a NotificationFlags instance. 1758 * @syscap SystemCapability.Notification.Notification 1759 * @systemapi 1760 * @since 9 1761 */ 1762 export type NotificationFlags = _NotificationFlags 1763 1764 /** 1765 * The status of the notification flag. 1766 * @syscap SystemCapability.Notification.Notification 1767 * @systemapi 1768 * @since 9 1769 */ 1770 export type NotificationFlagStatus = _NotificationFlagStatus 1771 1772 /** 1773 * Defines a NotificationRequest instance. 1774 * @syscap SystemCapability.Notification.Notification 1775 * @since 9 1776 */ 1777 export type NotificationRequest = _NotificationRequest 1778 1779 /** 1780 * Describes distributed options. 1781 * @syscap SystemCapability.Notification.Notification 1782 * @since 9 1783 */ 1784 export type DistributedOptions = _DistributedOptions 1785 1786 /** 1787 * Describes a NotificationSlot instance. 1788 * @syscap SystemCapability.Notification.Notification 1789 * @since 9 1790 */ 1791 export type NotificationSlot = _NotificationSlot 1792 1793 /** 1794 * Provides sorting information about an active notification. 1795 * @syscap SystemCapability.Notification.Notification 1796 * @systemapi 1797 * @since 9 1798 */ 1799 export type NotificationSorting = _NotificationSorting 1800 1801 /** 1802 * Describes a NotificationTemplate instance. 1803 * @syscap SystemCapability.Notification.Notification 1804 * @since 9 1805 */ 1806 export type NotificationTemplate = _NotificationTemplate 1807 1808 /** 1809 * Describes a NotificationUserInput instance. 1810 * @syscap SystemCapability.Notification.Notification 1811 * @since 9 1812 */ 1813 export type NotificationUserInput = _NotificationUserInput 1814} 1815 1816export default notificationManager; 1817