camera.delete
根据文件 URI 删除文件。此命令已在 API 级别 2 中修改。
参数
- API 级别 1
<ph type="x-smartling-placeholder">
</ph>
- fileUri::要删除的文件的 URI。由制造商决定
使用绝对 URI 还是相对 URI。客户端可将其视为不透明
标识符。
- API 级别 2
<ph type="x-smartling-placeholder">
</ph>
- fileUrls::待删除文件的绝对网址列表
也就是之前获得的,例如来自
camera.listFiles
或 camera.takePicture
命令。有三种特殊情况:
<ph type="x-smartling-placeholder"></ph>
- 该列表仅包含字符串“all”:删除相机中的所有文件。
- 此列表仅包含字符串“image”:请删除
摄像头。
- 该列表仅包含字符串“video”:删除
摄像头。
结果
- fileUrls::未成功删除的文件的网址。
请注意,当 fileUrls 中的所有网址都有效但摄像头无法正常运作时,就会发生这种情况
删除其中一部分如果任一网址无效,则显示错误代码
应该返回
invalidParameterValue
,而不删除任何文件。
这是 API 级别 2 中的新增配置。
错误
- missing 参数:未指定
fileUri
。
- invalidParameterName:输入参数名称无法识别。
- invalidParameterValue::识别输入参数名称,
但其值无效;例如,
fileUri
没有
在 API 级别 1 中不存在,或 fileUrls 中的任何网址在 API 级别 2 中都不存在。
命令 I/O |
命令输入(API 级别 1) |
{ "parameters": { "fileUri": "file URI" } } |
命令输出(API 级别 1) |
none |
命令输出(错误)(API 级别 1) |
{ "error": { "code": "invalidParameterName", "message": "Parameter XYZ is unrecognized." } } |
命令输入(API 级别 2) |
{ "parameters": { "fileUrls": [ "url1", "url2", "url3", ... "urln" ] } } |
命令输出(API 级别 2) |
{ "results": { "fileUrls": [ "urln" ] } } |
命令输出(错误)(API 级别 2) |
{ "error": { "code": "invalidParameterValue", "message": "Parameter url3 doesn't exist." } } |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-08-21。
[null,null,["最后更新时间 (UTC):2024-08-21。"],[[["The `deleteFile` command removes one or more files from the camera's storage."],["API level 1 uses `fileUri` to specify a single file for deletion, while API level 2 uses `fileUrls` to specify one or more files, or uses special values to delete all files, all images, or all videos."],["Errors are returned if parameters are missing, invalid, or if the specified files cannot be deleted."],["API level 2 introduced the `fileUrls` parameter and the ability to return a list of unsuccessfully deleted files in the results."]]],["This describes a command to delete files from a camera. In API level 1, it accepts a `fileUri` to delete a single file, where the URI's format is determined by the manufacturer. API level 2 was introduced to use the `fileUrls` parameter for multiple files, specified by absolute URLs. Special strings like \"all\", \"image\", or \"video\" delete all files, all images, or all videos. A list of `fileUrls` will return any files that did not delete correctly. Errors include invalid parameters or missing data.\n"]]