A minimal demonstration app showing how to integrate Android with OOTO Face API services.
This project is for evaluation and learning only (not production).
- Take photo — opens the camera and shows a preview.
- Enroll — sends the captured photo to create a face template.
- Search — performs 1:N face identification against existing templates.
- Delete — deletes a template by
templateId(appears after you get one from Enroll or Search).
- Android Studio (current stable)
- Min SDK 24, Target SDK 34
- Kotlin, Jetpack Compose (Material 3)
- Networking: Retrofit + OkHttp; JSON: Moshi
-
Add API credentials (do not hardcode): Create
local.propertiesin the project root (next togradle.properties):OOTO_APP_ID=your_app_id OOTO_APP_KEY=your_app_keyThese are injected into
BuildConfigand attached as headers by an OkHttp interceptor. -
Build & run:
- Open in Android Studio.
- Sync Gradle.
- Run on a device with a camera.
All requests include APP-ID and APP-KEY HTTP headers.
- Enroll —
POST /add- Query (optional):
check_liveness=true|false,check_deepfake=true|false - Body:
multipart/form-datawith:photo: JPEG/PNG filetemplateId(optional): string
- Query (optional):
- Search (Identify) —
POST /identify- Query (optional):
check_liveness=true|false,check_deepfake=true|false - Body:
multipart/form-datawith:photo: JPEG/PNG file
- Query (optional):
- Delete —
POST /delete- Body: JSON
{ "templateId": "<ID>" }
- Body: JSON
The demo sends
check_liveness=falseandcheck_deepfake=falseby default. Adjust inMainViewModel.
android.permission.CAMERA— requested at runtimeandroid.permission.INTERNET— declared in manifest
- Launch screen shows: Take photo, Enroll (disabled), Search (disabled).
- Tap Take photo → capture → preview appears → Enroll and Search become enabled.
- Tap Enroll → calls
/add→ shows returnedtemplateId→ Delete appears. - Tap Search → calls
/identify→ showstemplateId+similarityif matched → Delete appears. - Tap Delete → calls
/deletewith the lasttemplateId→ shows result.
- For non-2xx responses, the app attempts to parse error body as:
{ "transactionId": "...", "result": { "status": "...", "code": <int>, "info": "..." } } - Engine code
5is mapped to "No faces found" in the UI. - If parsing fails, a generic
"Request failed"is shown.
- 401/403: verify
OOTO_APP_ID/OOTO_APP_KEYinlocal.properties. - Camera denied: allow the camera permission in system settings and retry.
- "No faces found": ensure the photo contains a single, clear face.