---
title: 采集 API
canonical: https://developer.unico.io/zh-CN/dual-api/developers/sdks-and-tools/android/api-reference/capture-api
locale: zh-CN
generated_by: markdown-export
---

## 准备会话的方法

在从 SDK builder 获取的 `UnicoCheckCamera` 接口上调用这些方法。准备完成后，`CameraListener.onCameraReady(cameraOpener)` 回调会提供用于启动采集的 opener。

| 方法 | 描述 |
|---|---|
| `prepareCamera(config, listener)` | 准备自拍摄像头。`listener` 为 `CameraListener`。 |
| `prepareDocumentCamera(config, listener)` | 准备文件摄像头。`listener` 为 `DocumentCameraListener`。 |

## 开启摄像头

`onCameraReady` 触发后，对收到的 opener 对象调用 `open`：

**自拍 — `UnicoCheckCameraOpener.Camera`**

| 方法 | 描述 |
|---|---|
| `open(listener: iAcessoBioSelfie)` | 打开自拍摄像头 |
| `open(listener: iAcessoBioSelfie, webAppToken: String)` | 为用户旅程打开自拍摄像头，传入旅程令牌 |

**文件 — `UnicoCheckCameraOpener.Document`**

| 方法 | 描述 |
|---|---|
| `open(documentType: DocumentType, listener: iAcessoBioDocument)` | 打开指定类型的文件采集 |
| `open(documentType: DocumentType, description: String, listener: iAcessoBioDocument)` | 使用自定义描述标签打开文件采集 |

## DocumentType

定义要采集的文件类型。完整列表请参见[枚举](/developers/sdks-and-tools/android/api-reference/enums)。

## 结果类型及字段

**`ResultCamera`** — 成功时返回的对象。

| 字段 | 类型 | 描述 |
|---|---|---|
| `base64` | `String` | Base64 格式的采集图像 |
| `encrypted` | `String` | 发送到后端的 JWT |