• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# anm工具
2<!--Kit: Notification Kit-->
3<!--Subsystem: Notification-->
4<!--Owner: @michael_woo888-->
5<!--Designer: @dongqingran; @wulong158-->
6<!--Tester: @wanghong1997-->
7<!--Adviser: @huipeizi-->
8
9Advanced Notification Manager(通知管理工具,简称anm)是实现通知打印、设置通知参数等功能的工具,为开发者提供基本的通知调试和测试能力,例如打印已发布通知详细信息、设置通知缓存个数、使能通知等。
10
11## 环境要求
12
13在使用本工具前,开发者需要先获取<!--Del-->[<!--DelEnd-->hdc工具<!--Del-->](../../device-dev/subsystems/subsys-toolchain-hdc-guide.md)<!--DelEnd-->,执行hdc shell。
14
15当前工具仅支持在eng版本中使用,在user版本中使用会出现报错`/bin/sh: anm: inaccessible or not found.`。
16
17## anm工具命令列表
18
19| 命令 | 描述 |
20| ---- | --- |
21| help | 帮助命令,用于显示anm相关的帮助信息。 |
22| dump | 打印命令,用于打印通知相关信息。 |
23| setting | 设置命令,用于设置通知参数。 |
24
25## 帮助命令(help)
26
27  ```bash
28  # 显示anm相关的帮助信息
29  anm help
30  ```
31
32## 打印命令(dump)
33
34  ```bash
35  # 打印通知相关信息
36  anm dump [<options>]
37  ```
38
39  **打印命令参数列表**
40
41  | 参数             | 参数说明                           |
42  | ---------------- | ---------------------------------- |
43  | -A/--active      | 打印所有活跃的通知信息。             |
44  | -R/--recent      | 打印最近的通知信息。                 |
45  | -D/--distributed | 打印来自其他设备的分布式通知信息。   |
46  | -b/--bundle      | 可选参数,设置指定的Bundle名称打印。 |
47  | -u/--user-id     | 可选参数,设置指定的用户ID打印。     |
48  | -h/--help        | 帮助信息。                           |
49
50  **示例**:
51
52  ```bash
53  # 打印活跃的通知信息
54  anm dump -A
55  ```
56
57## 设置命令(setting)
58
59  ```bash
60  # 设置通知参数
61  anm setting [<options>]
62  ```
63
64  **设置命令参数列表**
65
66  | 参数                     | 参数说明                             |
67  | ------------------------ | ------------------------------------ |
68  | -c/--recent-count        | 设置保存在内存中的最近通知的最大个数。 |
69  | -e/--enable-notification | 设置通知使能开关。                     |
70  | -k/--collaboration-switch        | 设置通知是否支持跨设备协同至指定类型设备。<br/>```anm setting -k <deviceType>:<status>```<br/>**说明:** 从API version 18开始,新增支持该命令参数。<br/>deviceType表示需要指定的设备类型。取值范围包括:wearable(智能穿戴设备)、litewearable(轻量级智能穿戴设备)、headset(可穿戴式音频设备)。<br/>status表示需要指定的跨设备协同开关状态。取值为0表示开关为关闭状态,取值为1表示开关为打开状态。
71  | -b/--collaboration-switch-bundle | 设置指定应用的通知是否支持跨设备协同至指定类型设备。<br/>```anm setting -b <deviceType>:<bundleName>:<uid>:<status>```<br/>**说明:** 从API version 18开始,新增支持该命令参数。<br/>deviceType表示需要指定的设备类型。取值范围包括:wearable(智能穿戴设备)、litewearable(轻量级智能穿戴设备)、headset(可穿戴式音频设备)。<br/>status表示需要指定的跨设备协同开关状态。取值为0表示开关为关闭状态,取值为1表示开关为打开状态。|
72  | -o/--collaboration-switch-slot   | 设置指定渠道的通知是否支持通知跨设备协同至指定类型设备。<br/>```anm setting -o <deviceType>:<slotType>:<status>```<br/>**说明:** 从API version 18开始,新增支持该命令参数。<br/>deviceType表示需要指定的设备类型。取值范围包括:wearable(智能穿戴设备)、litewearable(轻量级智能穿戴设备)、headset(可穿戴式音频设备)。<br/>slotType表示需要指定的通知渠道类型。 取值范围参考[SlotType](../reference/apis-notification-kit/js-apis-notificationManager.md#slottype)。<br/>status表示需要指定的跨设备协同开关状态。取值为0表示开关为关闭状态,取值为1表示开关为打开状态。|
73  | -h/--help                | 帮助信息。                             |
74
75  **示例**:
76
77  ```bash
78  # 设置保存在内存中的最近通知的最大数为100个
79  anm setting -c 100
80
81  # 设置通知跨设备协同至wearable类型设备的开关为打开状态
82  anm setting -k wearable:1
83
84  # 设置包名为example,uid为10100的应用通知跨设备协同至litewearable类型设备的开关为关闭状态
85  anm setting -b litewearable:example:10100:0
86
87  # 设置渠道类型为0的通知跨设备协同至headset类型设备的开关为打开状态
88  anm setting -o headset:0:1
89  ```
90