鸿蒙OS开发文档 鸿蒙OS IAdvancedNotificationManager

2024-02-25 开发教程 鸿蒙OS开发文档 匿名 4

IAdvancedNotificationManager

@Deprecated
public interface IAdvancedNotificationManager
extends IRemoteBroker

已弃用。 此更改从 API 版本 5 开始生效。此 API 仅在高级通知系统中使用,不对外部系统开放。

Since:

1

字段摘要

修饰符和类型字段描述
static intANS_ABORT_ALL已弃用。
static intANS_ABORT_ONE已弃用。
static intANS_ADD_SLOTS已弃用。
static intANS_CAN_PUBLISH_NOTIFICATION_AS_BUNDLE已弃用。
static intANS_CREATE_SLOT已弃用。
static intANS_CREATE_SLOTGROUP已弃用。
static intANS_CREATE_SLOTGROUPS已弃用。
static intANS_DELETE_SLOT已弃用。
static intANS_DELETE_SLOTGROUP已弃用。
static intANS_GET_ACTIVE_NOTIFICATION已弃用。
static intANS_GET_ACTIVE_NOTIFICATION_NUM已弃用。
static intANS_GET_NOTIFICATION_AGENT已弃用。
static intANS_GET_SLOT已弃用。
static intANS_GET_SLOTGROUP已弃用。
static intANS_GET_SLOTGROUPS已弃用。
static intANS_GET_SLOTS已弃用。
static intANS_GET_SORTING已弃用。
static intANS_INQUIRY_BUNDLE_IMPORTANCE已弃用。
static intANS_INQUIRY_IS_SUSPENDED已弃用。
static intANS_NOTIFICATION_POLICY_ACCESS_PERMISSION已弃用。
static intANS_NOTIFICATIONS_ALLOWED已弃用。
static intANS_PUBLISH_NOTIFICATION_AS_BUNDLE已弃用。
static intANS_SCHEDULE_NOTIFICATION已弃用。
static intANS_SET_NOTIFICATION_AGENT已弃用。
static intANS_SET_NOTIFICATION_BADGE_NUM1已弃用。
static intANS_SET_NOTIFICATION_BADGE_NUM2已弃用。
static StringDESCRIPTOR已弃用。

方法总结

修饰符和类型方法描述
voidaddNotificationSlot(String bundle, NotificationSlot slot)已弃用。
voidaddNotificationSlotGroup(String bundle, NotificationSlotGroup slotGroup)已弃用。
voidaddNotificationSlotGroups(String bundle, ListNotificationSlotGroup slotGroups)已弃用。
voidaddNotificationSlots(String bundle, ListNotificationSlot slots)已弃用。
booleanareNotificationsSuspended(String bundle)已弃用。
voidcancelAllNotifications(String bundleName, int userId)已弃用。
voidcancelNotification(String label, String hashCode)已弃用。
booleancanPublishNotificationAsBundle(String bundle, String representativeBundle)已弃用。
intgetActiveNotificationNums(String bundle)已弃用。
SetNotificationRequestgetActiveNotifications(String bundle)已弃用。
intgetBundleImportance(String bundle)已弃用。
NotificationSortingMapgetCurrentAppSorting(String bundle)已弃用。
StringgetNotificationAgent(String bundle)已弃用。
NotificationSlotgetNotificationSlot(String bundle, String slotId)已弃用。
NotificationSlotGroupgetNotificationSlotGroup(String bundle, String slotGroupId)已弃用。
ListNotificationSlotGroupgetNotificationSlotGroups(String bundle)已弃用。
ListNotificationSlotgetNotificationSlots(String bundle)已弃用。
booleanhasNotificationPolicyAccessPermission(String bundle)已弃用。
booleanisAllowedNotify()已弃用。
voidpublishNotificationAsBundle(String bundle, String representativeBundle, NotificationRequest request)已弃用。
voidremoveNotificationSlot(String bundle, String slotId)已弃用。
voidscheduleNotification(String label, String hashCode, NotificationRequest request)已弃用。
voidsetNotificationAgent(String bundle, String agent)已弃用。
voidsetNotificationBadgeNum(String bundle)已弃用。
voidsetNotificationBadgeNum(String bundle, int num)已弃用。
从接口 ohos.rpc.IRemoteBroker 继承的方法
asObject

字段详细信息

ANS_ABORT_ALL

@Deprecated static final int ANS_ABORT_ALL

已弃用。

标识客户端请求的 cancelAllNotifications(java.lang.String,int) 方法。

Since:

1

ANS_ABORT_ONE

@Deprecated static final int ANS_ABORT_ONE

已弃用。

标识客户端请求的 cancelNotification(java.lang.String,java.lang.String) 方法。

Since:

3

ANS_ADD_SLOTS

@Deprecated static final int ANS_ADD_SLOTS

已弃用。

标识客户端请求的 addNotificationSlots(java.lang.String,java.util.List) 方法。

Since:

3

ANS_CAN_PUBLISH_NOTIFICATION_AS_BUNDLE

@Deprecated static final int ANS_CAN_PUBLISH_NOTIFICATION_AS_BUNDLE

已弃用。

标识客户端请求的 canPublishNotificationAsBundle(java.lang.String,java.lang.String) 方法。

Since:

3

ANS_CREATE_SLOT

@Deprecated static final int ANS_CREATE_SLOT

已弃用。

标识客户端请求的 addNotificationSlot(java.lang.String,ohos.event.notification.NotificationSlot) 方法。

Since:

1

ANS_CREATE_SLOTGROUP

@Deprecated static final int ANS_CREATE_SLOTGROUP

已弃用。

标识客户端请求的 addNotificationSlotGroup(java.lang.String,ohos.event.notification.NotificationSlotGroup) 方法。

Since:

3

ANS_CREATE_SLOTGROUPS

@Deprecated static final int ANS_CREATE_SLOTGROUPS

已弃用。

标识客户端请求的 addNotificationSlotGroups(java.lang.String,java.util.List) 方法。

Since:

3

ANS_DELETE_SLOT

@Deprecated static final int ANS_DELETE_SLOT

已弃用。

标识客户端请求的 removeNotificationSlot(java.lang.String,java.lang.String) 方法。

Since:

1

ANS_DELETE_SLOTGROUP

@Deprecated static final int ANS_DELETE_SLOTGROUP

已弃用。

标识客户端请求的 NotificationHelper#removeNotificationSlotGroup(String) 方法。

Since:

3

ANS_GET_ACTIVE_NOTIFICATION

@Deprecated static final int ANS_GET_ACTIVE_NOTIFICATION

已弃用。

标识客户端请求的 getActiveNotifications(java.lang.String) 方法。

Since:

1

ANS_GET_ACTIVE_NOTIFICATION_NUM

@Deprecated static final int ANS_GET_ACTIVE_NOTIFICATION_NUM

已弃用。

标识客户端请求的 getActiveNotificationNums(java.lang.String) 方法。

Since:

1

ANS_GET_NOTIFICATION_AGENT

@Deprecated static final int ANS_GET_NOTIFICATION_AGENT

已弃用。

标识客户端请求的 getNotificationAgent(java.lang.String) 方法。

Since:

3

ANS_GET_SLOT

@Deprecated static final int ANS_GET_SLOT

已弃用。

标识客户端请求的 getNotificationSlot(java.lang.String,java.lang.String) 方法。

Since:

1

ANS_GET_SLOTGROUP

@Deprecated static final int ANS_GET_SLOTGROUP

已弃用。

标识客户端请求的 getNotificationSlotGroup(java.lang.String,java.lang.String) 方法。

Since:

3

ANS_GET_SLOTGROUPS

@Deprecated static final int ANS_GET_SLOTGROUPS

已弃用。

标识客户端请求的 getNotificationSlotGroups(java.lang.String) 方法。

Since:

3

ANS_GET_SLOTS

@Deprecated static final int ANS_GET_SLOTS

已弃用。

标识客户端请求的 getNotificationSlots(java.lang.String) 方法。

Since:

3

ANS_GET_SORTING

@Deprecated static final int ANS_GET_SORTING

已弃用。

标识客户端请求的 getCurrentAppSorting(java.lang.String) 方法。

Since:

2

ANS_INQUIRY_BUNDLE_IMPORTANCE

@Deprecated static final int ANS_INQUIRY_BUNDLE_IMPORTANCE

已弃用。

标识客户端请求的 getBundleImportance(java.lang.String) 方法。

Since:

3

ANS_INQUIRY_IS_SUSPENDED

@Deprecated static final int ANS_INQUIRY_IS_SUSPENDED

已弃用。

标识客户端请求的 areNotificationsSuspended(java.lang.String) 方法。

Since:

3

ANS_NOTIFICATIONS_ALLOWED

@Deprecated static final int ANS_NOTIFICATIONS_ALLOWED

已弃用。

标识客户端请求的 isAllowedNotify() 方法。

Since:

3

ANS_NOTIFICATION_POLICY_ACCESS_PERMISSION

@Deprecated static final int ANS_NOTIFICATION_POLICY_ACCESS_PERMISSION

已弃用。

标识客户端请求的 hasNotificationPolicyAccessPermission(java.lang.String) 方法。

Since:

3

ANS_PUBLISH_NOTIFICATION_AS_BUNDLE

@Deprecated static final int ANS_PUBLISH_NOTIFICATION_AS_BUNDLE

已弃用。

标识客户端请求的 publishNotificationAsBundle(java.lang.String,java.lang.String,ohos.event.notification.NotificationRequest) 方法。

Since:

3

ANS_SCHEDULE_NOTIFICATION

@Deprecated static final int ANS_SCHEDULE_NOTIFICATION

已弃用。

标识客户端请求的 scheduleNotification(java.lang.String,java.lang.String,ohos.event.notification.NotificationRequest) 方法。

Since:

1

ANS_SET_NOTIFICATION_AGENT

@Deprecated static final int ANS_SET_NOTIFICATION_AGENT

已弃用。

标识客户端请求的 setNotificationAgent(java.lang.String,java.lang.String) 方法。

Since:

3

ANS_SET_NOTIFICATION_BADGE_NUM1

@Deprecated static final int ANS_SET_NOTIFICATION_BADGE_NUM1

已弃用。

标识客户端请求的 setNotificationBadgeNum(java.lang.String,int) 方法。

Since:

1

ANS_SET_NOTIFICATION_BADGE_NUM2

@Deprecated static final int ANS_SET_NOTIFICATION_BADGE_NUM2

已弃用。

标识客户端请求的 setNotificationBadgeNum(java.lang.String) 方法。

Since:

1

DESCRIPTOR

@Deprecated static final String DESCRIPTOR

已弃用。

唯一标识远程过程调用 (RPC) 对象。

Since:

1

方法详情

scheduleNotification

@Deprecated void scheduleNotification(String label, String hashCode, NotificationRequest request) throws RemoteException

已弃用。

发布通知。

参数:

参数名称参数描述
label表示要发布的 NotificationRequest 对象的标签。 可能为空。
hashCode表示要发布的 NotificationRequest 对象的哈希码。
request指示要发布的 NotificationRequest 对象。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

1

cancelAllNotifications

@Deprecated void cancelAllNotifications(String bundleName, int userId) throws RemoteException

已弃用。

取消指定应用程序和用户发布的所有通知。

参数:

参数名称参数描述
bundleName表示应用程序名称。
userId表示用户标识。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

1

cancelNotification

@Deprecated void cancelNotification(String label, String hashCode) throws RemoteException

已弃用。

取消与指定标签和哈希码匹配的已发布通知。

参数:

参数名称参数描述
label指示要取消的 NotificationRequest 对象的标签。
hashCode指示要取消的 NotificationRequest 对象的哈希码。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

3

addNotificationSlot

@Deprecated void addNotificationSlot(String bundle, NotificationSlot slot) throws RemoteException

已弃用。

根据给定的应用程序名称和 NotificationSlot 对象创建通知槽。

NotificationSlot 实例初始化后不能直接使用。 相反,您必须调用此方法来创建通知槽并将槽 ID 绑定到 NotificationRequest 对象,以便发布的通知可以具有 NotificationSlot 中设置的所有特征。

使用该方法创建通知槽后,只能更改通知槽的名称和描述。 对其他属性的更改,例如振动状态和通知音,将不再生效。

参数:

参数名称参数描述
bundle表示应用程序名称。
slot指示要创建的 NotificationSlot 对象。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

1

removeNotificationSlot

@Deprecated void removeNotificationSlot(String bundle, String slotId) throws RemoteException

已弃用。

根据给定的应用程序名称和槽 ID 删除通知槽。

参数:

参数名称参数描述
bundle表示应用程序名称。
slotId表示使用 addNotificationSlot(java.lang.String,ohos.event.notification.NotificationSlot) 创建的通知槽的 ID。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

1

getNotificationSlot

@Deprecated NotificationSlot getNotificationSlot(String bundle, String slotId) throws RemoteException

已弃用。

根据给定的应用程序名称和槽 ID 获取通知槽。

参数:

参数名称参数描述
bundle表示应用程序名称。
slotId表示使用 addNotificationSlot(java.lang.String,ohos.event.notification.NotificationSlot) 创建的通知槽的 ID。

返回:

返回创建的 NotificationSlot。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

1

getActiveNotifications

@Deprecated SetNotificationRequest getActiveNotifications(String bundle) throws RemoteException

已弃用。

获取指定应用的所有活动通知。

参数:

参数名称参数描述
bundle表示应用程序名称。

返回:

返回指定应用程序的所有活动 NotificationRequest 对象的集合。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

1

getActiveNotificationNums

@Deprecated int getActiveNotificationNums(String bundle) throws RemoteException

已弃用。

获取指定应用的活动通知数。

参数:

参数名称参数描述
bundle表示应用程序名称。

返回:

返回指定应用程序的活动通知数。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

1

setNotificationBadgeNum

@Deprecated void setNotificationBadgeNum(String bundle, int num) throws RemoteException

已弃用。

设置在指定应用程序的通知徽章上显示的数字。

参数:

参数名称参数描述
bundle表示应用程序名称。
num表示要显示的数字。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

1

setNotificationBadgeNum

@Deprecated void setNotificationBadgeNum(String bundle) throws RemoteException

已弃用。

将指定应用程序的活动通知数设置为其通知徽章上显示的数字。

参数:

参数名称参数描述
bundle表示应用程序名称。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

1

getCurrentAppSorting

@Deprecated NotificationSortingMap getCurrentAppSorting(String bundle) throws RemoteException

已弃用。

获取当前应用的通知排序地图。

参数:

参数名称参数描述
bundle表示应用程序名称。

返回:

返回当前应用程序的 NotificationSortingMap 对象。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

2

addNotificationSlotGroup

@Deprecated void addNotificationSlotGroup(String bundle, NotificationSlotGroup slotGroup) throws RemoteException

已弃用。

根据给定的应用程序名称和 NotificationSlotGroup 对象创建通知槽组。

参数:

参数名称参数描述
bundle表示应用程序名称。
slotGroup指示要创建的 NotificationSlotGroup 对象。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

3

addNotificationSlotGroups

@Deprecated void addNotificationSlotGroups(String bundle, ListNotificationSlotGroup slotGroups) throws RemoteException

已弃用。

根据给定的应用程序名称和 NotificationSlotGroup 对象创建多个通知槽组。

参数:

参数名称参数描述
bundle表示应用程序名称。
slotGroups指示要创建的多个 NotificationSlotGroup 对象。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

3

getNotificationSlotGroup

@Deprecated NotificationSlotGroup getNotificationSlotGroup(String bundle, String slotGroupId) throws RemoteException

已弃用。

根据给定的应用程序名称和槽组 ID 获取通知槽组。

参数:

参数名称参数描述
bundle表示应用程序名称。
slotGroupId表示使用 addNotificationSlotGroup(java.lang.String,ohos.event.notification.NotificationSlotGroup) 创建的通知槽组的 ID。

返回:

返回创建的 NotificationSlotGroup。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

3

hasNotificationPolicyAccessPermission

@Deprecated boolean hasNotificationPolicyAccessPermission(String bundle) throws RemoteException

已弃用。

检查此应用程序是否有权修改请勿打扰 (DND) 通知策略。

参数:

参数名称参数描述
bundle表示应用程序名称。

返回:

如果此应用程序具有权限,则返回 true; 否则返回 false。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

3

addNotificationSlots

@Deprecated void addNotificationSlots(String bundle, ListNotificationSlot slots) throws RemoteException

已弃用。

创建多个通知槽。

参数:

参数名称参数描述
bundle表示应用程序名称。
slots指示要创建的通知槽。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

3

getNotificationSlots

@Deprecated ListNotificationSlot getNotificationSlots(String bundle) throws RemoteException

已弃用。

获取该应用的所有通知槽。

参数:

参数名称参数描述
bundle表示应用程序名称。

返回:

返回此应用程序的所有通知槽。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

3

publishNotificationAsBundle

@Deprecated void publishNotificationAsBundle(String bundle, String representativeBundle, NotificationRequest request) throws RemoteException

已弃用。

以指定应用程序包的名称发布通知。 如果要发布的通知与未取消的已发布通知具有相同的 ID,则现有通知将被新通知替换。

参数:

参数名称参数描述
bundle表示应用程序名称。
representativeBundle指示允许您的应用程序通过调用 setNotificationAgent(java.lang.String,java.lang.String) 为其发布通知的应用程序包的名称。
request指示要发布的 NotificationRequest 对象。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

3

setNotificationAgent

@Deprecated void setNotificationAgent(String bundle, String agent) throws RemoteException

已弃用。

允许另一个应用程序充当代理以您的应用程序包的名称发布通知。 您可以通过将 null 传递给此方法来撤销此授权。

参数:

参数名称参数描述
bundle表示应用程序名称。
agent指示可以为您的应用程序发布通知的应用程序包的名称。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

3

getNotificationAgent

@Deprecated String getNotificationAgent(String bundle) throws RemoteException

已弃用。

获取可以以您的应用程序名称发布通知的应用程序包的名称。

参数:

参数名称参数描述
bundle表示应用程序名称。

返回:

返回可以为您的应用程序发布通知的应用程序包的名称(如果有); 否则返回 null。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

3

canPublishNotificationAsBundle

@Deprecated boolean canPublishNotificationAsBundle(String bundle, String representativeBundle) throws RemoteException

已弃用。

通过以给定代表包指示的另一个应用程序的名称调用 publishNotificationAsBundle(java.lang.String,java.lang.String,ohos.event.notification.NotificationRequest) 来检查您的应用程序是否有权发布通知。

参数:

参数名称参数描述
bundle表示应用程序名称。
representativeBundle指示您的应用程序所代表的应用程序包的名称。

返回:

如果您的应用程序可以为给定的代表包发布通知,则返回 true; 否则返回 false。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

3

getNotificationSlotGroups

@Deprecated ListNotificationSlotGroup getNotificationSlotGroups(String bundle) throws RemoteException

已弃用。

根据给定的应用程序名称获取属于该应用程序的所有通知槽组。

参数:

参数名称参数描述
bundle表示应用程序名称。

返回:

返回属于该应用的所有通知槽组。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

3

isAllowedNotify

@Deprecated boolean isAllowedNotify() throws RemoteException

已弃用。

检查此应用程序是否具有发布通知的权限。

返回:

如果此应用程序具有权限,则返回 true; 否则返回 false。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

3

areNotificationsSuspended

@Deprecated boolean areNotificationsSuspended(String bundle) throws RemoteException

已弃用。

返回来自此捆绑包的通知是否已暂停。

参数:

参数名称参数描述
bundle表示应用程序名称。

返回:

布尔值是否暂停来自此捆绑包的通知。

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

3

getBundleImportance

@Deprecated int getBundleImportance(String bundle) throws RemoteException

已弃用。

返回来自调用包的通知的重要性。

参数:

参数名称参数描述
bundle表示应用程序名称。

返回:

通知的重要性

Throws:

Throw名称Throw描述
RemoteException如果发生 IPC 异常,则抛出此异常。

Since:

3