• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-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 { 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 *
39 * <p>Generally, only system applications have permissions on notification subscription and unsubscribe.
40 * You can specify the content of a notification to be published and the content is carried by
41 * {@link NotificationRequest}. A notification ID is unique in an application and must be specified
42 * when using {@link NotificationRequest} to carry the notification content. If a notification
43 * with this ID has been published and you need to use this ID to publish another notification,
44 * the original notification will be updated. In addition, the notification ID can be used to cancel
45 * a notification by calling the {@link #cancel(int)} method.
46 *
47 * @name notification
48 * @since 7
49 * @syscap SystemCapability.Notification.Notification
50 * @permission N/A
51 * @deprecated since 9
52 * @useinstead ohos.notificationManager and ohos.notificationSubscribe
53 */
54declare namespace notification {
55  /**
56   * Publishes a notification.
57   *
58   * <p>If a notification with the same ID has been published by the current application and has not been deleted,
59   * this method will update the notification.
60   *
61   * @param request notification request
62   * @param callback callback function
63   * @deprecated since 9
64   * @useinstead ohos.notificationManager.publish
65   */
66  function publish(request: NotificationRequest, callback: AsyncCallback<void>): void;
67  function publish(request: NotificationRequest): Promise<void>;
68
69  /**
70   * Publishes a notification to the specified user.
71   *
72   * @since 8
73   * @param Publishes a notification.
74   * @param userId of subscriber receiving the notification
75   * @systemapi Hide this for inner system use.
76   * @permission ohos.permission.NOTIFICATION_CONTROLLER
77   * @deprecated since 9
78   * @useinstead ohos.notificationManager.publish
79   *
80   */
81   function publish(request: NotificationRequest, userId: number, callback: AsyncCallback<void>): void;
82   function publish(request: NotificationRequest, userId: number): Promise<void>;
83
84  /**
85   * Cancel a notification with the specified ID.
86   *
87   * @param id of the notification to cancel, which must be unique in the application.
88   * @param callback callback function
89   * @deprecated since 9
90   * @useinstead ohos.notificationManager.cancel
91   */
92  function cancel(id: number, callback: AsyncCallback<void>): void;
93
94  /**
95   * Cancel a notification with the specified label and ID.
96   *
97   * @param id ID of the notification to cancel, which must be unique in the application.
98   * @param label Label of the notification to cancel.
99   * @param callback callback function
100   * @deprecated since 9
101   * @useinstead ohos.notificationManager.cancel
102   */
103  function cancel(id: number, label: string, callback: AsyncCallback<void>): void;
104  function cancel(id: number, label?: string): Promise<void>;
105
106  /**
107   * Cancels all notifications of the current application.
108   * @deprecated since 9
109   * @useinstead ohos.notificationManager.cancelAll
110   */
111  function cancelAll(callback: AsyncCallback<void>): void;
112  function cancelAll(): Promise<void>;
113
114  /**
115   * Creates a notification slot.
116   *
117   * @param slot Indicates the notification slot to be created, which is set by {@link NotificationSlot}.
118   * This parameter must be specified.
119   * @param callback callback function
120   * @systemapi Hide this for inner system use.
121   * @permission ohos.permission.NOTIFICATION_CONTROLLER
122   * @deprecated since 9
123   * @useinstead ohos.notificationManager.addSlot
124   */
125  function addSlot(slot: NotificationSlot, callback: AsyncCallback<void>): void;
126
127  /**
128   * Creates a notification slot.
129   *
130   * @param slot Indicates the notification slot to be created, which is set by {@link NotificationSlot}.
131   * This parameter must be specified.
132   *
133   * @systemapi Hide this for inner system use.
134   * @permission ohos.permission.NOTIFICATION_CONTROLLER
135   * @deprecated since 9
136   * @useinstead ohos.notificationManager.addSlot
137   */
138  function addSlot(slot: NotificationSlot): Promise<void>;
139
140  /**
141   * Adds a slot type.
142   *
143   * @param type Slot type to add.
144   * @param callback callback function
145   * @deprecated since 9
146   * @useinstead ohos.notificationManager.addSlot
147   */
148  function addSlot(type: SlotType, callback: AsyncCallback<void>): void;
149  function addSlot(type: SlotType): Promise<void>;
150
151  /**
152   * Creates a notification slot.
153   *
154   * @param slots Indicates the notification slots to be created, which is set by {@link NotificationSlot}.
155   * This parameter must be specified.
156   * @param callback callback function
157   * @systemapi Hide this for inner system use.
158   * @permission ohos.permission.NOTIFICATION_CONTROLLER
159   * @deprecated since 9
160   * @useinstead ohos.notificationManager.addSlots
161   */
162  function addSlots(slots: Array<NotificationSlot>, callback: AsyncCallback<void>): void;
163
164  /**
165   * Creates a notification slot.
166   *
167   * @param slots Indicates the notification slots to be created, which is set by {@link NotificationSlot}.
168   * This parameter must be specified.
169   *
170   * @systemapi Hide this for inner system use.
171   * @permission ohos.permission.NOTIFICATION_CONTROLLER
172   * @deprecated since 9
173   * @useinstead ohos.notificationManager.addSlots
174   */
175  function addSlots(slots: Array<NotificationSlot>): Promise<void>;
176
177  /**
178   * Obtains a notification slot of the specified slot type.
179   *
180   * @param slotType Type of the notification slot to obtain.
181   * @param callback callback function
182   * @returns Returns the created {@link NotificationSlot}.
183   * @deprecated since 9
184   * @useinstead ohos.notificationManager.getSlot
185   */
186  function getSlot(slotType: SlotType, callback: AsyncCallback<NotificationSlot>): void;
187  function getSlot(slotType: SlotType): Promise<NotificationSlot>;
188
189  /**
190   * Obtains all NotificationSlot objects created by the current application.
191   *
192   * @returns Returns all notification slots of this application.
193   * @deprecated since 9
194   * @useinstead ohos.notificationManager.getSlots
195   */
196  function getSlots(callback: AsyncCallback<Array<NotificationSlot>>): void;
197  function getSlots(): Promise<Array<NotificationSlot>>;
198
199  /**
200   * Removes a NotificationSlot of the specified SlotType created by the current application.
201   *
202   * @param slotType Type of the NotificationSlot to remove.
203   * @param callback callback function
204   * @deprecated since 9
205   * @useinstead ohos.notificationManager.removeSlot
206   */
207  function removeSlot(slotType: SlotType, callback: AsyncCallback<void>): void;
208  function removeSlot(slotType: SlotType): Promise<void>;
209
210  /**
211   * Removes all NotificationSlot objects created by the current application.
212   * @deprecated since 9
213   * @useinstead ohos.notificationManager.removeAllSlots
214   */
215  function removeAllSlots(callback: AsyncCallback<void>): void;
216  function removeAllSlots(): Promise<void>;
217
218  /**
219   * Describes NotificationSlot types.
220   * @deprecated since 9
221   * @useinstead ohos.notificationManager.SlotType
222   */
223  export enum SlotType {
224    /**
225    * NotificationSlot of an unknown type.
226    */
227    UNKNOWN_TYPE = 0,
228
229    /**
230    * NotificationSlot for social communication.
231    */
232    SOCIAL_COMMUNICATION = 1,
233
234    /**
235    * NotificationSlot for service information.
236    */
237    SERVICE_INFORMATION = 2,
238
239    /**
240    * NotificationSlot for service information.
241    */
242    CONTENT_INFORMATION = 3,
243
244    /**
245    * NotificationSlot for other purposes.
246    */
247    OTHER_TYPES = 0xFFFF,
248  }
249
250  /**
251   * Describes notification content types.
252   *
253   * @name ContentType
254   * @since 7
255   * @syscap SystemCapability.Notification.Notification
256   * @permission N/A
257   * @deprecated since 9
258   * @useinstead ohos.notificationManager.ContentType
259   */
260  export enum ContentType {
261    /**
262    * Normal text notification.
263    */
264    NOTIFICATION_CONTENT_BASIC_TEXT,
265
266    /**
267    * Long text notification.
268    */
269    NOTIFICATION_CONTENT_LONG_TEXT,
270
271    /**
272    * Picture-attached notification.
273    */
274    NOTIFICATION_CONTENT_PICTURE,
275
276    /**
277    * Conversation notification.
278    */
279    NOTIFICATION_CONTENT_CONVERSATION,
280
281    /**
282    * Multi-line text notification.
283    */
284    NOTIFICATION_CONTENT_MULTILINE,
285  }
286
287  /**
288   * Indicates the level of the slot
289   *
290   * @deprecated since 9
291   * @useinstead ohos.notificationManager.SlotLevel
292   */
293  export enum SlotLevel {
294    /**
295    * Indicates that the notification function is disabled.
296    */
297    LEVEL_NONE = 0,
298
299    /**
300    * Indicates that the notification function is enabled but notification
301    * icons are not displayed in the status bar, with no banner or prompt tone.
302    */
303    LEVEL_MIN = 1,
304
305    /**
306    * Indicates that the notification function is enabled and notification
307    * icons are displayed in the status bar, with no banner or prompt tone.
308    */
309    LEVEL_LOW = 2,
310
311    /**
312    * Indicates that the notification function is enabled and notification
313    * icons are displayed in the status bar, with no banner but with a prompt tone.
314    */
315    LEVEL_DEFAULT = 3,
316
317    /**
318    * Indicates that the notification function is enabled and notification
319    * icons are displayed in the status bar, with a banner and a prompt tone.
320    */
321    LEVEL_HIGH = 4,
322  }
323
324  /**
325   * subscribe
326   *
327   * @systemapi Hide this for inner system use.
328   * @permission ohos.permission.NOTIFICATION_CONTROLLER
329   * @deprecated since 9
330   * @useinstead ohos.notificationSubscribe.subscribe
331   */
332  function subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback<void>): void;
333
334  /**
335   * subscribe
336   *
337   * @systemapi Hide this for inner system use.
338   * @permission ohos.permission.NOTIFICATION_CONTROLLER
339   * @deprecated since 9
340   * @useinstead ohos.notificationSubscribe.subscribe
341   */
342  function subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, callback: AsyncCallback<void>): void;
343
344  /**
345   * subscribe
346   *
347   * @systemapi Hide this for inner system use.
348   * @permission ohos.permission.NOTIFICATION_CONTROLLER
349   * @deprecated since 9
350   * @useinstead ohos.notificationSubscribe.subscribe
351   */
352  function subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): Promise<void>;
353
354  /**
355   * unsubscribe
356   *
357   * @systemapi Hide this for inner system use.
358   * @permission ohos.permission.NOTIFICATION_CONTROLLER
359   * @deprecated since 9
360   * @useinstead ohos.notificationSubscribe.unsubscribe
361   */
362  function unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback<void>): void;
363
364  /**
365   * unsubscribe
366   *
367   * @systemapi Hide this for inner system use.
368   * @permission ohos.permission.NOTIFICATION_CONTROLLER
369   * @deprecated since 9
370   * @useinstead ohos.notificationSubscribe.unsubscribe
371   */
372  function unsubscribe(subscriber: NotificationSubscriber): Promise<void>;
373
374  /**
375   * enableNotification
376   *
377   * @systemapi Hide this for inner system use.
378   * @permission ohos.permission.NOTIFICATION_CONTROLLER
379   * @deprecated since 9
380   * @useinstead ohos.notificationManager.setNotificationEnable
381   */
382  function enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallback<void>): void;
383
384  /**
385   * enableNotification
386   *
387   * @systemapi Hide this for inner system use.
388   * @permission ohos.permission.NOTIFICATION_CONTROLLER
389   * @deprecated since 9
390   * @useinstead ohos.notificationManager.setNotificationEnable
391   */
392  function enableNotification(bundle: BundleOption, enable: boolean): Promise<void>;
393
394  /**
395   * isNotificationEnabled
396   *
397   * @systemapi Hide this for inner system use.
398   * @permission ohos.permission.NOTIFICATION_CONTROLLER
399   * @deprecated since 9
400   * @useinstead ohos.notificationManager.isNotificationEnabled
401   */
402  function isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback<boolean>): void;
403
404  /**
405   * isNotificationEnabled
406   *
407   * @systemapi Hide this for inner system use.
408   * @permission ohos.permission.NOTIFICATION_CONTROLLER
409   * @deprecated since 9
410   * @useinstead ohos.notificationManager.isNotificationEnabled
411   */
412  function isNotificationEnabled(bundle: BundleOption): Promise<boolean>;
413
414  /**
415   * isNotificationEnabled
416   *
417   * @systemapi Hide this for inner system use.
418   * @permission ohos.permission.NOTIFICATION_CONTROLLER
419   * @deprecated since 9
420   * @useinstead ohos.notificationManager.isNotificationEnabled
421   */
422  function isNotificationEnabled(callback: AsyncCallback<boolean>): void;
423
424  /**
425   * isNotificationEnabled
426   *
427   * @systemapi Hide this for inner system use.
428   * @permission ohos.permission.NOTIFICATION_CONTROLLER
429   * @deprecated since 9
430   * @useinstead ohos.notificationManager.isNotificationEnabled
431   */
432  function isNotificationEnabled(): Promise<boolean>;
433
434  /**
435   * Checks whether this application has permission to publish notifications under the user.
436   *
437   * since 8
438   * @systemapi Hide this for inner system use.
439   * @permission ohos.permission.NOTIFICATION_CONTROLLER
440   * @deprecated since 9
441   * @useinstead ohos.notificationManager.isNotificationEnabled
442   */
443  function isNotificationEnabled(userId: number, callback: AsyncCallback<boolean>): void;
444  function isNotificationEnabled(userId: number): Promise<boolean>;
445
446  /**
447   * displayBadge
448   *
449   * @systemapi Hide this for inner system use.
450   * @permission ohos.permission.NOTIFICATION_CONTROLLER
451   * @deprecated since 9
452   * @useinstead ohos.notificationManager.displayBadge
453   */
454  function displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback<void>): void;
455
456  /**
457   * displayBadge
458   *
459   * @systemapi Hide this for inner system use.
460   * @permission ohos.permission.NOTIFICATION_CONTROLLER
461   * @deprecated since 9
462   * @useinstead ohos.notificationManager.displayBadge
463   */
464  function displayBadge(bundle: BundleOption, enable: boolean): Promise<void>;
465
466  /**
467   * isBadgeDisplayed
468   *
469   * @systemapi Hide this for inner system use.
470   * @permission ohos.permission.NOTIFICATION_CONTROLLER
471   * @deprecated since 9
472   * @useinstead ohos.notificationManager.isBadgeDisplayed
473   */
474  function isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback<boolean>): void;
475
476  /**
477   * isBadgeDisplayed
478   *
479   * @systemapi Hide this for inner system use.
480   * @permission ohos.permission.NOTIFICATION_CONTROLLER
481   * @deprecated since 9
482   * @useinstead ohos.notificationManager.isBadgeDisplayed
483   */
484  function isBadgeDisplayed(bundle: BundleOption): Promise<boolean>;
485
486  /**
487   * setSlotByBundle
488   *
489   * @systemapi Hide this for inner system use.
490   * @permission ohos.permission.NOTIFICATION_CONTROLLER
491   * @deprecated since 9
492   * @useinstead ohos.notificationManager.setSlotByBundle
493   */
494  function setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCallback<void>): void;
495
496  /**
497   * setSlotByBundle
498   *
499   * @systemapi Hide this for inner system use.
500   * @permission ohos.permission.NOTIFICATION_CONTROLLER
501   * @deprecated since 9
502   * @useinstead ohos.notificationManager.setSlotByBundle
503   */
504  function setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise<void>;
505
506  /**
507   * getSlotsByBundle
508   *
509   * @systemapi Hide this for inner system use.
510   * @permission ohos.permission.NOTIFICATION_CONTROLLER
511   * @deprecated since 9
512   * @useinstead ohos.notificationManager.getSlotsByBundle
513   */
514  function getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback<Array<NotificationSlot>>): void;
515
516  /**
517   * getSlotsByBundle
518   *
519   * @systemapi Hide this for inner system use.
520   * @permission ohos.permission.NOTIFICATION_CONTROLLER
521   * @deprecated since 9
522   * @useinstead ohos.notificationManager.getSlotsByBundle
523   */
524  function getSlotsByBundle(bundle: BundleOption): Promise<Array<NotificationSlot>>;
525
526  /**
527   * getSlotNumByBundle
528   *
529   * @systemapi Hide this for inner system use.
530   * @permission ohos.permission.NOTIFICATION_CONTROLLER
531   * @deprecated since 9
532   * @useinstead ohos.notificationManager.getSlotNumByBundle
533   */
534  function getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback<number>): void;
535
536  /**
537   * getSlotNumByBundle
538   *
539   * @systemapi Hide this for inner system use.
540   * @permission ohos.permission.NOTIFICATION_CONTROLLER
541   * @deprecated since 9
542   * @useinstead ohos.notificationManager.getSlotNumByBundle
543   */
544  function getSlotNumByBundle(bundle: BundleOption): Promise<number>;
545
546  /**
547   * remove
548   *
549   * @systemapi Hide this for inner system use.
550   * @permission ohos.permission.NOTIFICATION_CONTROLLER
551   * @deprecated since 9
552   * @useinstead ohos.notificationSubscribe.remove
553   */
554  function remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason, callback: AsyncCallback<void>): void;
555
556  /**
557   * remove
558   *
559   * @systemapi Hide this for inner system use.
560   * @permission ohos.permission.NOTIFICATION_CONTROLLER
561   * @deprecated since 9
562   * @useinstead ohos.notificationSubscribe.remove
563   */
564  function remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason): Promise<void>;
565
566  /**
567   * remove
568   *
569   * @systemapi Hide this for inner system use.
570   * @permission ohos.permission.NOTIFICATION_CONTROLLER
571   * @deprecated since 9
572   * @useinstead ohos.notificationSubscribe.remove
573   */
574  function remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback<void>): void;
575
576  /**
577   * remove
578   *
579   * @systemapi Hide this for inner system use.
580   * @permission ohos.permission.NOTIFICATION_CONTROLLER
581   * @deprecated since 9
582   * @useinstead ohos.notificationSubscribe.remove
583   */
584  function remove(hashCode: string, reason: RemoveReason): Promise<void>;
585
586  /**
587   * removeAll
588   *
589   * @systemapi Hide this for inner system use.
590   * @permission ohos.permission.NOTIFICATION_CONTROLLER
591   * @deprecated since 9
592   * @useinstead ohos.notificationSubscribe.removeAll
593   */
594  function removeAll(bundle: BundleOption, callback: AsyncCallback<void>): void;
595
596  /**
597   * removeAll
598   *
599   * @systemapi Hide this for inner system use.
600   * @permission ohos.permission.NOTIFICATION_CONTROLLER
601   * @deprecated since 9
602   * @useinstead ohos.notificationSubscribe.removeAll
603   */
604  function removeAll(callback: AsyncCallback<void>): void;
605
606  /**
607   * Remove all notifications under the specified user.
608   *
609   * @since 8
610   * @systemapi Hide this for inner system use.
611   * @permission ohos.permission.NOTIFICATION_CONTROLLER
612   * @deprecated since 9
613   * @useinstead ohos.notificationSubscribe.removeAll
614   */
615   function removeAll(userId: number, callback: AsyncCallback<void>): void;
616   function removeAll(userId: number): Promise<void>;
617
618  /**
619   * removeAll
620   *
621   * @systemapi Hide this for inner system use.
622   * @permission ohos.permission.NOTIFICATION_CONTROLLER
623   * @deprecated since 9
624   * @useinstead notificationSubscribe.removeAll
625   */
626  function removeAll(bundle?: BundleOption): Promise<void>;
627
628  /**
629   * Obtains all active notifications in the current system. The caller must have system permissions to
630   * call this method.
631   *
632   * @systemapi Hide this for inner system use.
633   * @permission ohos.permission.NOTIFICATION_CONTROLLER
634   * @deprecated since 9
635   * @useinstead ohos.notificationManager.getAllActiveNotifications
636   */
637  function getAllActiveNotifications(callback: AsyncCallback<Array<NotificationRequest>>): void;
638
639  /**
640   * Obtains all active notifications in the current system. The caller must have system permissions to
641   * call this method.
642   *
643   * @systemapi Hide this for inner system use.
644   * @permission ohos.permission.NOTIFICATION_CONTROLLER
645   * @deprecated since 9
646   * @useinstead ohos.notificationManager.getAllActiveNotifications
647   */
648  function getAllActiveNotifications(): Promise<Array<NotificationRequest>>;
649
650  /**
651   * Obtains the number of all active notifications.
652   *
653   * @deprecated since 9
654   * @useinstead ohos.notificationManager.getActiveNotificationCount
655   */
656  function getActiveNotificationCount(callback: AsyncCallback<number>): void;
657  function getActiveNotificationCount(): Promise<number>;
658
659  /**
660   * Obtains an array of active notifications.
661   *
662   * @deprecated since 9
663   * @useinstead ohos.notificationManager.cancelGroup
664   */
665  function getActiveNotifications(callback: AsyncCallback<Array<NotificationRequest>>): void;
666  function getActiveNotifications(): Promise<Array<NotificationRequest>>;
667
668  /**
669   * Cancel the notification of a specified group for this application.
670   *
671   * @since 8
672   * @deprecated since 9
673   * @useinstead ohos.notificationManager.cancelGroup
674   */
675  function cancelGroup(groupName: string, callback: AsyncCallback<void>): void;
676  function cancelGroup(groupName: string): Promise<void>;
677
678  /**
679   * Delete the notification of a specified group for this application.
680   *
681   * @since 8
682   * @systemapi Hide this for inner system use.
683   * @permission ohos.permission.NOTIFICATION_CONTROLLER
684   * @deprecated since 9
685   * @useinstead ohos.notificationManager.removeGroupByBundle
686   */
687  function removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback<void>): void;
688  function removeGroupByBundle(bundle: BundleOption, groupName: string): Promise<void>;
689
690  /**
691   * Set the Do Not Disturb date.
692   *
693   * @since 8
694   * @systemapi Hide this for inner system use.
695   * @permission ohos.permission.NOTIFICATION_CONTROLLER
696   * @deprecated since 9
697   * @useinstead ohos.notificationManager.setDoNotDisturbDate
698   */
699  function setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback<void>): void;
700  function setDoNotDisturbDate(date: DoNotDisturbDate): Promise<void>;
701
702  /**
703   * Set the Do Not Disturb date under the specified user.
704   *
705   * @since 8
706   * @systemapi Hide this for inner system use.
707   * @permission ohos.permission.NOTIFICATION_CONTROLLER
708   * @deprecated since 9
709   * @useinstead ohos.notificationManager.setDoNotDisturbDate
710   */
711   function setDoNotDisturbDate(date: DoNotDisturbDate, userId: number, callback: AsyncCallback<void>): void;
712   function setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise<void>;
713
714  /**
715   * Obtains the Do Not Disturb date.
716   *
717   * @since 8
718   * @systemapi Hide this for inner system use.
719   * @permission ohos.permission.NOTIFICATION_CONTROLLER
720   * @deprecated since 9
721   * @useinstead ohos.notificationManager.getDoNotDisturbDate
722   */
723  function getDoNotDisturbDate(callback: AsyncCallback<DoNotDisturbDate>): void;
724  function getDoNotDisturbDate(): Promise<DoNotDisturbDate>;
725
726  /**
727   * Obtains the Do Not Disturb date.
728   *
729   * @since 8
730   * @systemapi Hide this for inner system use under the specified user.
731   * @permission ohos.permission.NOTIFICATION_CONTROLLER
732   * @deprecated since 9
733   * @useinstead ohos.notificationManager.getDoNotDisturbDate
734   */
735   function getDoNotDisturbDate(userId: number, callback: AsyncCallback<DoNotDisturbDate>): void;
736   function getDoNotDisturbDate(userId: number): Promise<DoNotDisturbDate>;
737
738  /**
739   * Obtains whether to support the Do Not Disturb mode.
740   *
741   * @since 8
742   * @systemapi Hide this for inner system use.
743   * @permission ohos.permission.NOTIFICATION_CONTROLLER
744   * @deprecated since 9
745   * @useinstead ohos.notificationManager.isSupportDoNotDisturbMode
746   */
747  function supportDoNotDisturbMode(callback: AsyncCallback<boolean>): void;
748  function supportDoNotDisturbMode(): Promise<boolean>;
749
750  /**
751   * Obtains whether the template is supported by the system.
752   *
753   * @since 8
754   * @param templateName Name of template to be Obtained
755   * @param callback callback function
756   * @deprecated since 9
757   * @useinstead ohos.notificationManager.isSupportTemplate
758   */
759  function isSupportTemplate(templateName: string, callback: AsyncCallback<boolean>): void;
760  function isSupportTemplate(templateName: string): Promise<boolean>;
761
762  /**
763   * Request permission to send notification.
764   *
765   * @since 8
766   * @deprecated since 9
767   * @useinstead ohos.notificationManager.requestEnableNotification
768   */
769   function requestEnableNotification(callback: AsyncCallback<void>): void;
770   function requestEnableNotification(): Promise<void>;
771
772  /**
773   * Sets whether the device supports distributed notification.
774   *
775   * @since 8
776   * @systemapi Hide this for inner system use.
777   * @permission ohos.permission.NOTIFICATION_CONTROLLER
778   * @deprecated since 9
779   * @useinstead ohos.notificationManager.setDistributedEnable
780   */
781  function enableDistributed(enable: boolean, callback: AsyncCallback<void>): void;
782  function enableDistributed(enable: boolean): Promise<void>;
783
784  /**
785   * Obtains whether the device supports distributed notification.
786   *
787   * @since 8
788   * @deprecated since 9
789   * @useinstead ohos.notificationManager.isDistributedEnabled
790   */
791  function isDistributedEnabled(callback: AsyncCallback<boolean>): void;
792  function isDistributedEnabled(): Promise<boolean>;
793
794  /**
795   * Sets whether an application supports distributed notification.
796   *
797   * @since 8
798   * @systemapi Hide this for inner system use.
799   * @permission ohos.permission.NOTIFICATION_CONTROLLER
800   * @deprecated since 9
801   * @useinstead ohos.notificationManager.setDistributedEnableByBundle
802   */
803  function enableDistributedByBundle(bundle: BundleOption, enable: boolean, callback: AsyncCallback<void>): void;
804  function enableDistributedByBundle(bundle: BundleOption, enable: boolean): Promise<void>;
805
806  /**
807   * Obtains whether an application supports distributed notification.
808   *
809   * @since 8
810   * @systemapi Hide this for inner system use.
811   * @permission ohos.permission.NOTIFICATION_CONTROLLER
812   * @deprecated since 9
813   * @useinstead ohos.notificationManager.isDistributedEnabledByBundle
814   */
815  function isDistributedEnabledByBundle(bundle: BundleOption, callback: AsyncCallback<boolean>): void;
816  function isDistributedEnabledByBundle(bundle: BundleOption): Promise<boolean>;
817
818  /**
819   * Obtains the remind modes of the notification.
820   *
821   * @since 8
822   * @systemapi Hide this for inner system use.
823   * @permission ohos.permission.NOTIFICATION_CONTROLLER
824   * @deprecated since 9
825   * @useinstead ohos.notificationManager.getDeviceRemindType
826   */
827  function getDeviceRemindType(callback: AsyncCallback<DeviceRemindType>): void;
828  function getDeviceRemindType(): Promise<DeviceRemindType>;
829
830  /**
831   * Describes a BundleOption.
832   *
833   * @deprecated since 9
834   * @useinstead ohos.notificationManager.BundleOption
835   */
836  export interface BundleOption {
837    bundle: string;
838    uid?: number;
839  }
840
841  /**
842   * Describes a NotificationKey, which can be used to identify a notification.
843   *
844   * @deprecated since 9
845   * @useinstead ohos.notificationManager.NotificationKey
846   */
847  export interface NotificationKey {
848    id: number;
849    label?: string;
850  }
851
852  /**
853   * The type of the Do Not Disturb.
854   *
855   * @since 8
856   * @systemapi Hide this for inner system use.
857   * @deprecated since 9
858   * @useinstead ohos.notificationManager.DoNotDisturbType
859   */
860  export enum DoNotDisturbType {
861    /**
862     * Non do not disturb type notification
863     */
864    TYPE_NONE = 0,
865
866    /**
867     * Execute do not disturb once in the set time period (only watch hours and minutes)
868     */
869    TYPE_ONCE = 1,
870
871    /**
872     * Execute do not disturb every day with a set time period (only watch hours and minutes)
873     */
874    TYPE_DAILY = 2,
875
876    /**
877     * Execute in the set time period (specify the time, month, day and hour)
878     */
879    TYPE_CLEARLY = 3,
880  }
881
882  /**
883   * Describes a DoNotDisturbDate instance.
884   *
885   * @systemapi Hide this for inner system use.
886   * @deprecated since 9
887   * @useinstead ohos.notificationManager.DoNotDisturbDate
888   */
889  export interface DoNotDisturbDate {
890    /**
891     * the type of the Do Not Disturb.
892     *
893     * @since 8
894     */
895    type: DoNotDisturbType;
896
897    /**
898     * the start time of the Do Not Disturb.
899     *
900     * @since 8
901     */
902    begin: Date;
903
904    /**
905     * the end time of the Do Not Disturb.
906     *
907     * @since 8
908     */
909    end: Date;
910  }
911
912  /**
913   * The remind type of the notification.
914   *
915   * @since 8
916   * @systemapi Hide this for inner system use.
917   * @deprecated since 9
918   * @useinstead ohos.notificationManager.DeviceRemindType
919   */
920  export enum DeviceRemindType {
921    /**
922     * The device is not in use, no reminder
923     */
924    IDLE_DONOT_REMIND = 0,
925
926    /**
927     * The device is not in use, remind
928     */
929    IDLE_REMIND = 1,
930
931    /**
932     * The device is in use, no reminder
933     */
934    ACTIVE_DONOT_REMIND = 2,
935
936    /**
937     * The device is in use, reminder
938     */
939    ACTIVE_REMIND = 3,
940  }
941
942  /**
943   * Notification source type
944   *
945   * @since 8
946   * @systemapi Hide this for inner system use.
947   * @deprecated since 9
948   * @useinstead ohos.notificationManager.SourceType
949   */
950  export enum SourceType {
951    /**
952     * General notification
953     */
954    TYPE_NORMAL = 0,
955
956    /**
957     * Continuous notification
958     */
959    TYPE_CONTINUOUS = 1,
960
961    /**
962     * Scheduled notification
963     */
964    TYPE_TIMER = 2,
965  }
966
967   /**
968   * Reason for remove a notification
969   *
970   * @systemapi Hide this for inner system use.
971   * @deprecated since 9
972   * @useinstead ohos.notificationManager.RemoveReason
973   */
974  export enum RemoveReason {
975    /**
976     * Notification clicked notification on the status bar
977     */
978    CLICK_REASON_REMOVE = 1,
979
980    /**
981     * User dismissal notification  on the status bar
982     */
983    CANCEL_REASON_REMOVE = 2,
984  }
985}
986
987export default notification;
988