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