@doubao-dev/plugin-app-dev 0.0.0-stage → 0.0.40-canary-dea0ddc73-20261026073950

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/README.md +10 -2
  2. package/dist/147.js +9 -0
  3. package/dist/assets.d.ts +5 -0
  4. package/dist/assets.js +4 -0
  5. package/dist/index.d.ts +43 -0
  6. package/dist/index.js +1378 -0
  7. package/dist/plugin.d.ts +102 -0
  8. package/dist/plugin.js +4995 -0
  9. package/dist/preview.js +16 -0
  10. package/dist/rslib-runtime.js +33 -0
  11. package/dist/skills/doubao-plugin-app/SKILL.md +21 -0
  12. package/dist/skills/doubao-plugin-app/references/app-development.md +85 -0
  13. package/dist/skills/doubao-plugin-app/references/frontend/components/container-overlay.md +131 -0
  14. package/dist/skills/doubao-plugin-app/references/frontend/components/form-controls.md +146 -0
  15. package/dist/skills/doubao-plugin-app/references/frontend/components/interactive-controls.md +120 -0
  16. package/dist/skills/doubao-plugin-app/references/frontend/components/map-canvas.md +107 -0
  17. package/dist/skills/doubao-plugin-app/references/frontend/components/overview.md +43 -0
  18. package/dist/skills/doubao-plugin-app/references/frontend/components/scroll-list.md +149 -0
  19. package/dist/skills/doubao-plugin-app/references/frontend/components/text-media.md +209 -0
  20. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/01-/345/237/272/347/241/200.md +1389 -0
  21. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/02-/347/263/273/347/273/237.md +1376 -0
  22. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/03-/350/207/252/345/256/232/344/271/211/351/200/232/344/277/241.md +127 -0
  23. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/04-/345/256/232/344/275/215.md +784 -0
  24. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/05-/345/255/230/345/202/250.md +1176 -0
  25. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/06-/350/267/257/347/224/261.md +839 -0
  26. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/07-/347/225/214/351/235/242.md +376 -0
  27. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/08-/344/272/244/344/272/222.md +1319 -0
  28. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/09-/350/276/223/345/205/245.md +192 -0
  29. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/10-/347/275/221/347/273/234.md +900 -0
  30. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/11-/345/252/222/344/275/223.md +1496 -0
  31. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/12-/344/270/232/345/212/241/350/203/275/345/212/233.md +1281 -0
  32. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/13-/347/231/273/345/275/225.md +511 -0
  33. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/14-/346/224/257/344/273/230.md +943 -0
  34. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/15-/346/225/260/346/215/256/345/210/206/346/236/220.md +124 -0
  35. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/16-/350/223/235/347/211/231.md +3364 -0
  36. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/17-wi-fi.md +1028 -0
  37. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/18-/345/212/240/351/200/237/345/272/246/350/256/241.md +354 -0
  38. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/19-ibeacon.md +508 -0
  39. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/20-/347/275/227/347/233/230.md +320 -0
  40. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/21-/350/256/276/345/244/207/346/226/271/345/220/221.md +351 -0
  41. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/22-/351/231/200/350/236/272/344/273/252.md +354 -0
  42. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/23-/345/252/222/344/275/223-/350/256/276/345/244/207-/347/275/221/347/273/234.md +264 -0
  43. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/24-/347/237/255/344/277/241.md +155 -0
  44. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/25-/346/227/240/351/232/234/347/242/215.md +144 -0
  45. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/26-/345/237/272/347/241/200/344/277/241/346/201/257.md +238 -0
  46. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/27-/347/224/265/346/261/240.md +235 -0
  47. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/28-/345/211/252/350/264/264/346/235/277.md +303 -0
  48. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/29-/345/212/240/345/257/206.md +126 -0
  49. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/30-/346/227/245/345/216/206.md +417 -0
  50. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/31-/347/224/265/350/257/235.md +144 -0
  51. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/32-/346/211/253/347/240/201.md +236 -0
  52. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/33-/345/261/217/345/271/225.md +747 -0
  53. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/34-/351/234/207/345/212/250.md +277 -0
  54. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/35-/346/226/207/344/273/266/347/263/273/347/273/237.md +431 -0
  55. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/common-errors.md +69 -0
  56. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/groups.md +43 -0
  57. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/quick-reference.md +436 -0
  58. package/dist/skills/doubao-plugin-app/references/frontend/examples/common-patterns.md +590 -0
  59. package/dist/skills/doubao-plugin-app/references/frontend/examples/doubao-agentic-service-api-recipes.md +209 -0
  60. package/dist/skills/doubao-plugin-app/references/frontend/examples/page-widget-basics.md +368 -0
  61. package/dist/skills/doubao-plugin-app/references/frontend/examples/page-widget-recipes.md +65 -0
  62. package/dist/skills/doubao-plugin-app/references/frontend/framework/core.md +283 -0
  63. package/dist/skills/doubao-plugin-app/references/frontend/guides/auth.md +277 -0
  64. package/dist/skills/doubao-plugin-app/references/frontend/guides/best-practices.md +574 -0
  65. package/dist/skills/doubao-plugin-app/references/frontend/guides/client-tools-and-events.md +209 -0
  66. package/dist/skills/doubao-plugin-app/references/frontend/guides/component-development.md +832 -0
  67. package/dist/skills/doubao-plugin-app/references/frontend/guides/debugger-mcp.md +537 -0
  68. package/dist/skills/doubao-plugin-app/references/frontend/guides/expired-widget.md +101 -0
  69. package/dist/skills/doubao-plugin-app/references/frontend/guides/performance-optimization.md +417 -0
  70. package/dist/skills/doubao-plugin-app/references/frontend/guides/troubleshooting.md +278 -0
  71. package/dist/skills/doubao-plugin-app/references/frontend/lynx/best-practices.md +720 -0
  72. package/dist/skills/doubao-plugin-app/references/frontend/lynx/css/pseudo-classes.md +149 -0
  73. package/dist/skills/doubao-plugin-app/references/frontend/lynx/css/selectors.md +224 -0
  74. package/dist/skills/doubao-plugin-app/references/frontend/lynx/css/supported-properties.md +269 -0
  75. package/dist/skills/doubao-plugin-app/references/frontend/lynx/css/values-and-units.md +314 -0
  76. package/dist/skills/doubao-plugin-app/references/frontend/lynx/layout/flex-layout.md +334 -0
  77. package/dist/skills/doubao-plugin-app/references/frontend/lynx/layout/grid-layout.md +408 -0
  78. package/dist/skills/doubao-plugin-app/references/frontend/lynx/layout/linear-layout.md +355 -0
  79. package/dist/skills/doubao-plugin-app/references/frontend/lynx/layout/relative-layout.md +189 -0
  80. package/dist/skills/doubao-plugin-app/references/frontend/lynx/lynx-vs-web/css-differences.md +737 -0
  81. package/dist/skills/doubao-plugin-app/references/frontend/lynx/lynx-vs-web/migration-guide.md +669 -0
  82. package/dist/skills/doubao-plugin-app/references/frontend/lynx/lynx-vs-web/unsupported-features.md +290 -0
  83. package/dist/skills/doubao-plugin-app/references/frontend/lynx/overview.md +60 -0
  84. package/dist/skills/doubao-plugin-app/references/frontend/lynx/patterns/animation.md +243 -0
  85. package/dist/skills/doubao-plugin-app/references/frontend/lynx/patterns/responsive.md +194 -0
  86. package/dist/skills/doubao-plugin-app/references/frontend/lynx/patterns/theming.md +143 -0
  87. package/dist/skills/doubao-plugin-app/references/frontend/lynx/quick-reference.md +229 -0
  88. package/dist/skills/doubao-plugin-app/references/frontend/rules/dos-and-donts.md +479 -0
  89. package/dist/skills/doubao-plugin-app/references/frontend/widget-templates/design-boundary.md +46 -0
  90. package/dist/skills/doubao-plugin-app/references/frontend/widget-templates/overview.md +118 -0
  91. package/dist/skills/doubao-plugin-app/references/frontend/widget-templates/props.md +301 -0
  92. package/dist/skills/doubao-plugin-app/references/mcp-and-cards.md +38 -0
  93. package/dist/templates/README.md.template +11 -0
  94. package/dist/templates/com.doubao/app/manifest.yaml +41 -0
  95. package/dist/templates/com.doubao/app/package.json.template +13 -0
  96. package/dist/templates/com.doubao/app/src/app.config.ts.template +5 -0
  97. package/dist/templates/com.doubao/app/src/app.ts.template +3 -0
  98. package/dist/templates/com.doubao/app/src/pages/home/index.css +14 -0
  99. package/dist/templates/com.doubao/app/src/pages/home/index.tsx.template +14 -0
  100. package/dist/templates/com.doubao/app/src/widgets/example/index.tsx.template +29 -0
  101. package/dist/templates/com.doubao/app/tsconfig.json +19 -0
  102. package/dist/templates/mcp.json +9 -0
  103. package/dist/templates/plugin.json.template +29 -0
  104. package/dist/templates/skills/example/SKILL.md.template +14 -0
  105. package/dist/upload.d.ts +44 -0
  106. package/dist/upload.js +38 -0
  107. package/package.json +60 -3
@@ -0,0 +1,508 @@
1
+ # 豆包应用插件的端能力 API: iBeacon
2
+
3
+ iBeacon 搜索和结果读取能力。
4
+
5
+ [返回目录](./groups.md) | [返回速查](./quick-reference.md)
6
+
7
+ ## 速查
8
+
9
+ | API | 说明 |
10
+ | --- | --- |
11
+ | [startBeaconDiscovery](#startbeacondiscovery) | 开始搜索附近的 iBeacon。 |
12
+ | [stopBeaconDiscovery](#stopbeacondiscovery) | 停止搜索附近的 iBeacon。 |
13
+ | [getBeacons](#getbeacons) | 获取已搜索到的 iBeacon 列表。 |
14
+
15
+ ## API 详情
16
+
17
+ <a id="startbeacondiscovery"></a>
18
+ ### startBeaconDiscovery()
19
+
20
+ # startBeaconDiscovery
21
+
22
+ 开始搜索附近的 iBeacon。
23
+
24
+ ## 扫码预览
25
+ ![扫码预览 startBeaconDiscovery](https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=doubao%3A%2F%2Fdoubao_apps%3Fapp_id%3Ddb_1McM5Ni%26path%3D%252Fpages%252Fapi%252Fdevice%252Fbeacon%252Findex)
26
+
27
+ ## 使用限制
28
+
29
+ > [!WARNING]
30
+ > **Android**:Android 不读取该字段,蓝牙不可用时仍会失败;Android 调用方设置该参数不会生效。
31
+
32
+ ## 支持版本
33
+
34
+ 前端库版本不低于 `0.0.25`。
35
+
36
+ ## 支持平台
37
+
38
+ <table>
39
+ <thead>
40
+ <tr><th>平台</th><th>支持情况</th></tr>
41
+ </thead>
42
+ <tbody>
43
+ <tr><td>Android</td><td>支持</td></tr>
44
+ <tr><td>iOS</td><td>支持</td></tr>
45
+ <tr><td>PC</td><td>不支持</td></tr>
46
+ <tr><td>HarmonyOS</td><td>不支持</td></tr>
47
+ </tbody>
48
+ </table>
49
+
50
+ ## 支持场景
51
+
52
+ <table>
53
+ <thead>
54
+ <tr><th>场景</th><th>支持情况</th></tr>
55
+ </thead>
56
+ <tbody>
57
+ <tr><td>页面</td><td>支持</td></tr>
58
+ <tr><td>卡片</td><td>不支持</td></tr>
59
+ </tbody>
60
+ </table>
61
+
62
+ ## 接入准备
63
+
64
+ ### 权限要求
65
+
66
+ <table>
67
+ <thead>
68
+ <tr><th>类型</th><th>标识</th><th>是否必须</th><th>平台</th><th>说明</th></tr>
69
+ </thead>
70
+ <tbody>
71
+ <tr><td>系统权限</td><td>定位权限</td><td>必须</td><td>Android、iOS</td><td>需要定位权限以搜索 iBeacon</td></tr>
72
+ <tr><td>系统权限</td><td>蓝牙权限</td><td>必须</td><td>Android、iOS</td><td>需要蓝牙权限以搜索 iBeacon</td></tr>
73
+ </tbody>
74
+ </table>
75
+
76
+ ### 授权行为
77
+
78
+ - 调用会主动申请定位和蓝牙权限。用户拒绝后再次调用会直接失败,需引导用户在系统设置中开启定位和蓝牙权限后重试。
79
+
80
+ ### 前置条件
81
+
82
+ - 确保设备蓝牙已开启,并授予定位和蓝牙权限
83
+
84
+ ## 使用说明
85
+
86
+ 需配对调用 stopBeaconDiscovery。
87
+
88
+ - 使用限制:Android 会忽略 `ignoreBluetoothAvailable`,蓝牙不可用时仍会失败;不再需要时调用 `stopBeaconDiscovery`
89
+
90
+ ## 调用方式
91
+
92
+ ### 异步 API
93
+
94
+ ```typescript
95
+ startBeaconDiscovery(params: StartBeaconDiscoveryParams): Promise<object>
96
+ ```
97
+
98
+ ## 入参
99
+
100
+ <table>
101
+ <thead>
102
+ <tr><th>名称</th><th>类型</th><th>必填</th><th>默认值</th><th>约束</th><th>说明</th></tr>
103
+ </thead>
104
+ <tbody>
105
+ <tr><td><code>ignoreBluetoothAvailable</code></td><td><code>boolean</code></td><td>否</td><td><code>false</code></td><td>仅 iOS 生效,Android 忽略该字段</td><td>iOS 下是否忽略蓝牙可用性校验。Android:Android 不读取该字段,蓝牙不可用时仍会失败。</td></tr>
106
+ <tr><td><code>uuids</code></td><td><code>string[]</code></td><td>是</td><td>-</td><td>-</td><td>要搜索的 iBeacon UUID 列表。</td></tr>
107
+ </tbody>
108
+ </table>
109
+
110
+ ## 调用示例
111
+
112
+ ```typescript
113
+ import { startBeaconDiscovery } from '@doubao-dev/framework/api';
114
+
115
+ await startBeaconDiscovery({ uuids: ['FDA50693-A4E2-4FB1-AFCF-C6EB07647825'] });
116
+ ```
117
+
118
+ ## 成功返回
119
+
120
+ 无返回字段。
121
+
122
+ ### 返回示例
123
+
124
+ ```json
125
+ {}
126
+ ```
127
+
128
+ ## 错误处理
129
+
130
+ 错误对象和通用错误码见 [通用错误处理](./common-errors.md#错误返回)。
131
+
132
+ ### 失败示例
133
+
134
+ ```json
135
+ {
136
+ "errNo": 104,
137
+ "errMsg": "invalid parameter"
138
+ }
139
+ ```
140
+
141
+ ### 错误码
142
+
143
+ <table>
144
+ <thead>
145
+ <tr><th>errNo</th><th>errMsg</th><th>平台</th><th>触发条件</th><th>处理建议</th></tr>
146
+ </thead>
147
+ <tbody>
148
+ <tr><td><code>104</code></td><td><code>invalid parameter</code></td><td>Android、iOS</td><td>uuids 为空</td><td>传入至少一个合法的 iBeacon UUID</td></tr>
149
+ <tr><td><code>106</code></td><td><code>system permission denied</code></td><td>Android、iOS</td><td>定位或蓝牙权限未授予</td><td>在系统设置中授予定位和蓝牙权限后重试</td></tr>
150
+ <tr><td><code>116</code></td><td><code>resource not found</code></td><td>Android、iOS</td><td>蓝牙不可用或已关闭</td><td>开启蓝牙后重试</td></tr>
151
+ <tr><td><code>103</code></td><td><code>feature not support</code></td><td>iOS</td><td>当前设备不支持 iBeacon 搜索</td><td>更换支持 iBeacon 的设备</td></tr>
152
+ </tbody>
153
+ </table>
154
+
155
+ #### 通用错误码
156
+
157
+ <table>
158
+ <thead>
159
+ <tr><th>errNo</th><th>errMsg</th><th>说明</th><th>平台</th></tr>
160
+ </thead>
161
+ <tbody>
162
+ <tr><td><code>102</code></td><td><code>internal error</code></td><td>内部错误</td><td>Android、iOS</td></tr>
163
+ </tbody>
164
+ </table>
165
+
166
+ ## 平台差异
167
+
168
+ - **iOS**:支持通过 `ignoreBluetoothAvailable` 跳过蓝牙可用性校验
169
+
170
+ <a id="stopbeacondiscovery"></a>
171
+ ### stopBeaconDiscovery()
172
+
173
+ # stopBeaconDiscovery
174
+
175
+ 停止搜索附近的 iBeacon。
176
+
177
+ ## 扫码预览
178
+ ![扫码预览 stopBeaconDiscovery](https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=doubao%3A%2F%2Fdoubao_apps%3Fapp_id%3Ddb_1McM5Ni%26path%3D%252Fpages%252Fapi%252Fdevice%252Fbeacon%252Findex)
179
+
180
+ ## 支持版本
181
+
182
+ 前端库版本不低于 `0.0.25`。
183
+
184
+ ## 支持平台
185
+
186
+ <table>
187
+ <thead>
188
+ <tr><th>平台</th><th>支持情况</th></tr>
189
+ </thead>
190
+ <tbody>
191
+ <tr><td>Android</td><td>支持</td></tr>
192
+ <tr><td>iOS</td><td>支持</td></tr>
193
+ <tr><td>PC</td><td>不支持</td></tr>
194
+ <tr><td>HarmonyOS</td><td>不支持</td></tr>
195
+ </tbody>
196
+ </table>
197
+
198
+ ## 支持场景
199
+
200
+ <table>
201
+ <thead>
202
+ <tr><th>场景</th><th>支持情况</th></tr>
203
+ </thead>
204
+ <tbody>
205
+ <tr><td>页面</td><td>支持</td></tr>
206
+ <tr><td>卡片</td><td>不支持</td></tr>
207
+ </tbody>
208
+ </table>
209
+
210
+ ## 接入准备
211
+
212
+ ### 权限要求
213
+
214
+ <table>
215
+ <thead>
216
+ <tr><th>类型</th><th>标识</th><th>是否必须</th><th>平台</th><th>说明</th></tr>
217
+ </thead>
218
+ <tbody>
219
+ <tr><td>系统权限</td><td>定位权限</td><td>按条件</td><td>Android</td><td>Android 停止搜索时会校验定位权限</td></tr>
220
+ <tr><td>系统权限</td><td>蓝牙权限</td><td>按条件</td><td>Android</td><td>Android 停止搜索时会校验蓝牙权限</td></tr>
221
+ </tbody>
222
+ </table>
223
+
224
+ ### 授权行为
225
+
226
+ - **Android**:停止搜索时会校验定位和蓝牙权限,权限缺失时调用可能失败;在系统设置中授予对应权限后可正常调用。
227
+
228
+ ### 前置条件
229
+
230
+ - 无额外前置条件;通常在 `startBeaconDiscovery` 后调用
231
+
232
+ ## 使用说明
233
+
234
+ - 使用限制:iOS 恒返回成功,Android 权限缺失时可能失败
235
+
236
+ ## 调用方式
237
+
238
+ ### 异步 API
239
+
240
+ ```typescript
241
+ stopBeaconDiscovery(params?: object): Promise<object>
242
+ ```
243
+
244
+ ## 入参
245
+
246
+ 无。
247
+
248
+ ## 调用示例
249
+
250
+ ```typescript
251
+ import { stopBeaconDiscovery } from '@doubao-dev/framework/api';
252
+
253
+ await stopBeaconDiscovery();
254
+ ```
255
+
256
+ ## 成功返回
257
+
258
+ 无返回字段。
259
+
260
+ ### 返回示例
261
+
262
+ ```json
263
+ {}
264
+ ```
265
+
266
+ ## 错误处理
267
+
268
+ 错误对象和通用错误码见 [通用错误处理](./common-errors.md#错误返回)。
269
+
270
+ ### 失败示例
271
+
272
+ ```json
273
+ {
274
+ "errNo": 106,
275
+ "errMsg": "system permission denied"
276
+ }
277
+ ```
278
+
279
+ ### 错误码
280
+
281
+ <table>
282
+ <thead>
283
+ <tr><th>errNo</th><th>errMsg</th><th>平台</th><th>触发条件</th><th>处理建议</th></tr>
284
+ </thead>
285
+ <tbody>
286
+ <tr><td><code>106</code></td><td><code>system permission denied</code></td><td>Android</td><td>定位或蓝牙权限未授予</td><td>在系统设置中授予定位和蓝牙权限后重试</td></tr>
287
+ </tbody>
288
+ </table>
289
+
290
+ #### 通用错误码
291
+
292
+ <table>
293
+ <thead>
294
+ <tr><th>errNo</th><th>errMsg</th><th>说明</th><th>平台</th></tr>
295
+ </thead>
296
+ <tbody>
297
+ <tr><td><code>102</code></td><td><code>internal error</code></td><td>内部错误</td><td>Android</td></tr>
298
+ </tbody>
299
+ </table>
300
+
301
+ ## 平台差异
302
+
303
+ - **iOS**:停止搜索恒返回成功,不校验权限
304
+
305
+ <a id="getbeacons"></a>
306
+ ### getBeacons()
307
+
308
+ # getBeacons
309
+
310
+ 获取已搜索到的 iBeacon 列表。
311
+
312
+ ## 扫码预览
313
+ ![扫码预览 getBeacons](https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=doubao%3A%2F%2Fdoubao_apps%3Fapp_id%3Ddb_1McM5Ni%26path%3D%252Fpages%252Fapi%252Fdevice%252Fbeacon%252Findex)
314
+
315
+ ## 支持版本
316
+
317
+ 前端库版本不低于 `0.0.25`。
318
+
319
+ ## 支持平台
320
+
321
+ <table>
322
+ <thead>
323
+ <tr><th>平台</th><th>支持情况</th></tr>
324
+ </thead>
325
+ <tbody>
326
+ <tr><td>Android</td><td>支持</td></tr>
327
+ <tr><td>iOS</td><td>支持</td></tr>
328
+ <tr><td>PC</td><td>不支持</td></tr>
329
+ <tr><td>HarmonyOS</td><td>不支持</td></tr>
330
+ </tbody>
331
+ </table>
332
+
333
+ ## 支持场景
334
+
335
+ <table>
336
+ <thead>
337
+ <tr><th>场景</th><th>支持情况</th></tr>
338
+ </thead>
339
+ <tbody>
340
+ <tr><td>页面</td><td>支持</td></tr>
341
+ <tr><td>卡片</td><td>不支持</td></tr>
342
+ </tbody>
343
+ </table>
344
+
345
+ ## 接入准备
346
+
347
+ ### 权限要求
348
+
349
+ <table>
350
+ <thead>
351
+ <tr><th>类型</th><th>标识</th><th>是否必须</th><th>平台</th><th>说明</th></tr>
352
+ </thead>
353
+ <tbody>
354
+ <tr><td>系统权限</td><td>定位权限</td><td>按条件</td><td>Android</td><td>Android 获取列表时会校验定位权限</td></tr>
355
+ <tr><td>系统权限</td><td>蓝牙权限</td><td>按条件</td><td>Android</td><td>Android 获取列表时会校验蓝牙权限</td></tr>
356
+ </tbody>
357
+ </table>
358
+
359
+ ### 授权行为
360
+
361
+ - **Android**:获取列表时会校验定位和蓝牙权限,权限缺失时调用可能失败;在系统设置中授予对应权限后可正常调用。
362
+
363
+ ### 前置条件
364
+
365
+ - 无额外前置条件;通常在 `startBeaconDiscovery` 后调用
366
+
367
+ ## 使用说明
368
+
369
+ - 使用限制:iOS 恒返回成功,Android 权限缺失时可能失败
370
+
371
+ ## 调用方式
372
+
373
+ ### 异步 API
374
+
375
+ ```typescript
376
+ getBeacons(params?: object): Promise<GetBeaconsResult>
377
+ ```
378
+
379
+ ## 入参
380
+
381
+ 无。
382
+
383
+ ## 调用示例
384
+
385
+ ```typescript
386
+ import { getBeacons } from '@doubao-dev/framework/api';
387
+
388
+ const { beacons } = await getBeacons();
389
+
390
+ console.log(beacons);
391
+ ```
392
+
393
+ ## 成功返回
394
+
395
+ <table>
396
+ <thead>
397
+ <tr><th>名称</th><th>类型</th><th>必返</th><th>说明</th></tr>
398
+ </thead>
399
+ <tbody>
400
+ <tr><td><code>beacons</code></td><td><code>BeaconInfo[]</code></td><td>是</td><td>当前搜到的 iBeacon 列表。</td></tr>
401
+ <tr><td><code>beacons[].accuracy</code></td><td><code>number</code></td><td>是</td><td>距离,单位米。</td></tr>
402
+ <tr><td><code>beacons[].major</code></td><td><code>number</code></td><td>是</td><td>主 ID。</td></tr>
403
+ <tr><td><code>beacons[].minor</code></td><td><code>number</code></td><td>是</td><td>次 ID。</td></tr>
404
+ <tr><td><code>beacons[].proximity</code></td><td><code>BeaconProximity</code></td><td>是</td><td>距离等级。</td></tr>
405
+ <tr><td><code>beacons[].rssi</code></td><td><code>number</code></td><td>是</td><td>RSSI 信号强度,单位 dBm。</td></tr>
406
+ <tr><td><code>beacons[].uuid</code></td><td><code>string</code></td><td>是</td><td>Beacon UUID。</td></tr>
407
+ </tbody>
408
+ </table>
409
+
410
+ ### 返回示例
411
+
412
+ ```json
413
+ {
414
+ "beacons": [
415
+ {
416
+ "uuid": "FDA50693-A4E2-4FB1-AFCF-C6EB07647825",
417
+ "major": 10001,
418
+ "minor": 19641,
419
+ "proximity": 1,
420
+ "accuracy": 0.52,
421
+ "rssi": -59
422
+ }
423
+ ]
424
+ }
425
+ ```
426
+
427
+ ## 错误处理
428
+
429
+ 错误对象和通用错误码见 [通用错误处理](./common-errors.md#错误返回)。
430
+
431
+ ### 失败示例
432
+
433
+ ```json
434
+ {
435
+ "errNo": 106,
436
+ "errMsg": "system permission denied"
437
+ }
438
+ ```
439
+
440
+ ### 错误码
441
+
442
+ <table>
443
+ <thead>
444
+ <tr><th>errNo</th><th>errMsg</th><th>平台</th><th>触发条件</th><th>处理建议</th></tr>
445
+ </thead>
446
+ <tbody>
447
+ <tr><td><code>106</code></td><td><code>system permission denied</code></td><td>Android</td><td>定位或蓝牙权限未授予</td><td>在系统设置中授予定位和蓝牙权限后重试</td></tr>
448
+ </tbody>
449
+ </table>
450
+
451
+ #### 通用错误码
452
+
453
+ <table>
454
+ <thead>
455
+ <tr><th>errNo</th><th>errMsg</th><th>说明</th><th>平台</th></tr>
456
+ </thead>
457
+ <tbody>
458
+ <tr><td><code>102</code></td><td><code>internal error</code></td><td>内部错误</td><td>Android</td></tr>
459
+ </tbody>
460
+ </table>
461
+
462
+ ## 平台差异
463
+
464
+ - **iOS**:获取列表恒返回成功,不校验权限
465
+
466
+ ## 相关类型
467
+
468
+ <a id="startbeacondiscoveryparams"></a>
469
+ ### StartBeaconDiscoveryParams
470
+
471
+ 开始搜索 iBeacon 的请求参数。
472
+
473
+ #### Properties
474
+
475
+ • **uuids**: `string[]` - 要搜索的 iBeacon UUID 列表
476
+ • **ignoreBluetoothAvailable?**: `boolean` - iOS 下是否忽略蓝牙可用性校验
477
+
478
+ <a id="beaconproximity"></a>
479
+ ### BeaconProximity
480
+
481
+ iBeacon 距离等级。
482
+
483
+ #### Type
484
+
485
+ `0 | 1 | 2 | 3`
486
+
487
+ <a id="beaconinfo"></a>
488
+ ### BeaconInfo
489
+
490
+ iBeacon 设备信息。
491
+
492
+ #### Properties
493
+
494
+ • **uuid**: `string` - Beacon UUID
495
+ • **major**: `number` - 主 ID
496
+ • **minor**: `number` - 次 ID
497
+ • **proximity**: `BeaconProximity` - 距离等级
498
+ • **accuracy**: `number` - 距离,单位米
499
+ • **rssi**: `number` - RSSI 信号强度,单位 dBm
500
+
501
+ <a id="getbeaconsresult"></a>
502
+ ### GetBeaconsResult
503
+
504
+ 获取 iBeacon 列表的返回结果。
505
+
506
+ #### Properties
507
+
508
+ • **beacons**: `BeaconInfo[]` - 当前搜到的 iBeacon 列表