Vitruvyan Docs
Android Oculus Prime App — Roadmap & Architecture
Last updated: Feb 17, 2026 14:45 UTC
Date: February 17, 2026
Status: Planning Baseline
Scope: Android Edge Client for Oculus Prime — IoT interoperability test case
1. Mission
Costruire un'applicazione Android di riferimento per il modulo Oculus Prime che dimostri la capacità di Vitruvyan di integrarsi con fonti esterne (IoT, sensori mobili, acquisizione multimediale) tramite architettura client-server offline-first.
Obiettivo primario: usare Android come test harness remoto per inviare diversi tipi di artifact verso Vitruvyan e verificare end-to-end la robustezza della pipeline.
Questo test serve a validare in anticipo che, spostando in futuro Oculus Prime (o moduli analoghi) su device remoti (IoT, mini-PC, VPS, smartphone), il sistema centrale sia in grado di acquisire, persistire e processare correttamente i flussi esterni.
2. Analisi Architettura Esistente
L'architettura attuale è già progettata per questo scenario ed è composta da:
2.1 Oculus Prime Edge Gateway (services/api_edge_oculus_prime/)
Caratteristiche:
- Gateway unico edge: endpoint media-specifici esposti direttamente dal servizio Oculus Prime
- Upload multipart: file + metadata + correlation ID
- Pipeline visibility: endpoint operativi per health, pipeline status, eventi recenti
- Transport contract: upload diretto verso endpoint
/api/oculus-prime/{type}
Componenti chiave:
Operational endpoints:
GET /health— health servizio + connettività DBGET /api/oculus-prime/pipeline— stato pipeline ingestioneGET /api/oculus-prime/events— eventi recenti Oculus Prime
2.2 Core Oculus Prime API (services/api_edge_oculus_prime/)
Caratteristiche:
- 7 media types: document, image, audio, video, CAD, landscape, geo
- Agents specializzati: in
infrastructure/edge/oculus_prime/core/agents/ - Evidence Packs: immutabili, append-only PostgreSQL
- Event emission: Redis Streams (
oculus_prime.evidence.created) - Pre-epistemic: NO NER, NO embeddings (upstream processing)
Endpoint pattern:
POST /api/oculus-prime/documentPOST /api/oculus-prime/imagePOST /api/oculus-prime/audioPOST /api/oculus-prime/videoPOST /api/oculus-prime/cadPOST /api/oculus-prime/landscapePOST /api/oculus-prime/geo
2.3 Infrastructure Layer (infrastructure/edge/oculus_prime/core/)
Compliance: 94% ACCORDO-FONDATIVO-INTAKE-V1.1
Componenti:
- Guardrails: validazione payload, integrity hash (SHA-256)
- Event emitter: idempotency keys, retry logic, audit log
- Schema SQL: append-only, consumer groups compliance
- Agents: document, image, audio, video, CAD, landscape, geo intake
Event flow:
3. Proposta Architettura Android App
3.1 Modello Client-Server Ibrido
3.2 Technology Stack
| Layer | Technology | Rationale |
|---|---|---|
| UI | Jetpack Compose (Material 3) | Modern declarative UI, type-safe |
| Networking | Retrofit + OkHttp | Industry standard, coroutines support |
| Database | Room (SQLite wrapper) | Type-safe DAO, migration support |
| Async | Kotlin Coroutines | Structured concurrency, cancellation |
| Background Sync | WorkManager | Guaranteed execution, battery-aware |
| Camera | CameraX | Modern camera API, multi-device support |
| Location | FusedLocationProviderClient | Battery-efficient GPS |
| DI | Hilt (Dagger) | Android-optimized dependency injection |
4. Implementazione Tecnica
4.1 Android SDK Core (vitruvyan-android-sdk/)
Modulo 1: sdk-core/ (networking + contracts)
Modulo 2: sdk-offline/ (SQLite outbox + sync)
Modulo 3: sdk-sensors/ (IoT acquisition helpers)
4.2 Reference Android App (examples/android/oculus-prime-demo/)
Features Principali
| Feature | Description | Implementation |
|---|---|---|
| Camera Capture | Take photo → upload with GPS metadata | CameraX + Location API |
| Video Recording | Record video → chunked upload | CameraX video mode |
| Audio Recording | Record audio → upload with timestamp | MediaRecorder wrapper |
| Document Picker | Select PDF/DOCX → upload | Intent.ACTION_OPEN_DOCUMENT |
| Gallery Upload | Batch upload images | Intent.ACTION_GET_CONTENT (multiple) |
| Offline Mode | Queue uploads → auto-sync on reconnect | Room + WorkManager |
| Real-time Status | Pending count, sync progress | StateFlow + Compose |
| IoT Simulation | Periodic GPS tracking + auto-upload | WorkManager periodic task |
App Architecture (MVVM + Clean Architecture)
5. Considerazioni Sicurezza
5.1 Device Identity
5.2 Secure Token Storage
5.3 Security Checklist
| Security Feature | Implementation | Priority |
|---|---|---|
| Bearer Token Auth | Authorization: Bearer <token> header | ✅ MVP |
| Token Encryption | EncryptedSharedPreferences (AES256-GCM) | ✅ MVP |
| Device Identity | Persistent UUID + fingerprint | ✅ MVP |
| Payload Signing | HMAC-SHA256 with device secret | 🔶 Phase 2 |
| Anti-Replay | Nonce + timestamp window validation | 🔶 Phase 2 |
| mTLS | Client certificate authentication | 🔶 Production |
| Certificate Pinning | Prevent MITM attacks | 🔶 Production |
| Root Detection | Block execution on rooted devices | 🔵 Optional |
6. Struttura Repository Proposta
7. Implementation Roadmap
Sprint 1: SDK Foundation (Week 1 — Feb 17-23, 2026)
Goals:
- ✅ Setup Android SDK multi-module Gradle project
- ✅ Implement
OculusPrimeClientwith Retrofit - ✅ Implement
LocalOutboxManagerwith Room - ✅ Unit tests for SDK core (JUnit + MockK)
Deliverables:
vitruvyan-sdk/sdk-coremodule (networking + contracts)vitruvyan-sdk/sdk-offlinemodule (outbox + sync)- Unit test coverage ≥ 80%
- SDK README with integration guide
Acceptance Criteria:
- Upload image via
OculusPrimeClient.uploadImage()succeeds in integration test - Offline enqueue + sync completes without errors
- Oculus Prime API accepts uploaded media and returns evidence IDs
Sprint 2: Android Demo App (Week 2 — Feb 24 - Mar 2, 2026)
Goals:
- ✅ Setup Jetpack Compose UI project
- ✅ Integrate CameraX for photo capture
- ✅ Implement upload flow (online/offline)
- ✅ Dashboard with upload status
Deliverables:
oculus-prime-demoapp with Jetpack Compose UI- Camera capture screen
- Upload queue screen (pending/sent/failed list)
- Dashboard with metrics (pending count, sync progress)
Acceptance Criteria:
- Capture photo → auto-upload in online mode
- Capture photo → enqueue in offline mode → sync on reconnect
- UI shows real-time upload status
Sprint 3: IoT Sensors Integration (Week 3 — Mar 3-9, 2026)
Goals:
- ✅ Implement GPS tracking
- ✅ Auto-upload with location metadata
- ✅ Background WorkManager sync
- ✅ Upload completion notifications
Deliverables:
sdk-sensorsmodule (camera, audio, GPS helpers)- Periodic GPS tracking worker
- Background sync worker
- Android notifications for upload completion
Acceptance Criteria:
- GPS coordinates embedded in image metadata
- Background sync runs every 15 minutes (configurable)
- User receives notification on successful upload
Sprint 4: Security Hardening (Week 4 — Mar 10-16, 2026)
Goals:
- ✅ Device identity + fingerprinting
- ✅ Token encryption (EncryptedSharedPreferences)
- ✅ Payload signing (HMAC-SHA256)
- ✅ mTLS setup (optional for production)
Deliverables:
DeviceIdentityManagerimplementationSecureTokenManagerwith AES256-GCM encryption- Payload signing integration
- Security audit report
Acceptance Criteria:
- API token encrypted at rest
- Device ID persists across app restarts
- HMAC signature validated server-side (if implemented)
Sprint 5: End-to-End Validation (Week 5 — Mar 17-23, 2026)
Goals:
- ✅ End-to-end test from Android to Sacred Orders
- ✅ Performance benchmarking (upload latency, battery usage)
- ✅ Documentation + deployment guide
Deliverables:
- E2E test suite (Android → Oculus Prime → Redis Streams)
- Performance benchmark report
- Final user documentation
- Video demo
Acceptance Criteria:
- Uploaded image appears in Qdrant vector store (downstream processing)
- Upload latency < 5 seconds (WiFi) / < 10 seconds (4G)
- Battery drain < 5% per hour (background tracking)
8. Vantaggi Architettura Proposta
| Aspetto | Beneficio | Dettagli |
|---|---|---|
| Gateway unico | Minore complessità architetturale | SDK integra direttamente Oculus Prime |
| Offline-first nativo | SQLite locale + sync automatico | Funziona senza connessione, sincronizzazione trasparente |
| SDK generico | Riutilizzabile per iOS/Flutter/React Native | Pattern adattabile a qualsiasi mobile platform |
| Event-driven | Allineato a Sacred Orders processing | Eventi Redis Streams → pipeline epistemic standard |
| Scalabile IoT | Pattern testato per M2M (MQTT futuro) | Architettura pronta per fleet management, sensori industriali |
| Security-first | Device identity + mTLS ready | Sicurezza baked-in, non patchwork |
| Battery-efficient | WorkManager + FusedLocation | Android-native ottimizzazioni batteria |
| Type-safe | Kotlin + Compose | Crash-resistant, compile-time checks |
9. Acceptance Criteria
9.1 Functional Requirements
- ✅ Upload media files (image, audio, video, document) da Android device
- ✅ Offline buffering con queue persistente (SQLite)
- ✅ Auto-sync quando connessione torna disponibile
- ✅ GPS metadata automatica per foto/video
- ✅ Background sync non blocca UI, battery-aware
- ✅ Real-time status (pending uploads, sync progress, errors)
- ✅ Token authentication sicura (Bearer token + encryption)
9.2 Non-Functional Requirements
| Requirement | Target | Measurement |
|---|---|---|
| Upload latency | < 5 sec (WiFi), < 10 sec (4G) | Time to HTTP 200 response |
| Battery usage | < 5% drain/hour (background tracking) | Battery Historian profiling |
| Offline capacity | ≥ 100 uploads queued | SQLite row count |
| Sync reliability | ≥ 99% success (excludes network failure) | Sent / (Sent + Failed) ratio |
| Crash rate | < 0.1% sessions | Firebase Crashlytics |
| App size | < 20 MB APK | APK Analyzer |
9.3 Integration Requirements
- ✅ Compatibility con Oculus Prime API multipart contract
- ✅ Evidence Pack creati downstream in PostgreSQL
- ✅ Redis Streams events emessi (
oculus_prime.evidence.created) - ✅ Sacred Orders processing attivato (Codex → Memory → Vault)
- ✅ Qdrant embeddings disponibili post-processing
- ✅ Remote pipeline validation: test superato con artifact inviati da device remoto verso core Vitruvyan
10. Risks and Mitigations
| Risk | Impact | Probability | Mitigation |
|---|---|---|---|
| Android API fragmentation | Medium | Medium | Min SDK 26 (Android 8+), CameraX backport |
| Battery drain | High | Medium | WorkManager constraints, FusedLocation |
| Network instability | Medium | High | Offline-first design, retry with backoff |
| Storage overflow | Medium | Low | Auto-cleanup sent uploads, configurable retention |
| Security breach | High | Low | Token encryption, mTLS optional, payload signing |
| SDK maintenance burden | Medium | Medium | Clear versioning, semantic release, CI/CD |
11. Success Metrics
11.1 Technical Metrics
- Code coverage: ≥ 80% (unit + integration tests)
- Build time: < 2 minutes (clean build)
- APK size: < 20 MB
- Method count: < 64K (no MultiDex needed)
11.2 Product Metrics
- Upload success rate: ≥ 99% (excludes network failures)
- Offline queue capacity: ≥ 100 uploads
- Background sync efficiency: ≥ 95% uploads synced within 1 hour
- User-perceived latency: < 5 seconds (WiFi)
11.3 Ecosystem Metrics
- Cross-platform reusability: SDK pattern adaptable to iOS/Flutter
- Downstream processing: Evidence Packs reach Qdrant within 30 seconds
- Event emission: Redis Streams events consumed by Sacred Orders
12. Next Actions (Immediate Sprint Planning)
Week 1 (Feb 17-23, 2026) — SDK Foundation
Day 1-2:
- Create
infrastructure/edge/oculus_prime/android/vitruvyan-sdk/structure - Setup Gradle multi-module build (
sdk-core,sdk-offline,sdk-sensors) - Define Kotlin package structure (
com.vitruvyan.sdk.*)
Day 3-4:
- Implement
OculusPrimeClientwith Retrofit - Implement media request data classes (
ImageUploadRequest,DocumentUploadRequest, ...) - Add Bearer token authentication interceptor
Day 5:
- Implement
LocalOutboxManagerwith Room - Write unit tests (JUnit + MockK)
- SDK README with integration examples
Week 2 (Feb 24 - Mar 2, 2026) — Android Demo App
Day 1-2:
- Create
oculus-prime-demoAndroid project (Jetpack Compose) - Setup Hilt dependency injection
- Implement
HomeScreendashboard UI
Day 3-4:
- Integrate CameraX for photo capture
- Implement
CameraScreen+CameraViewModel - Wire upload flow (capture → enqueue → upload)
Day 5:
- Implement upload queue screen (pending/sent/failed)
- Add real-time status updates (StateFlow)
- Integration test: capture → upload → verify server-side
13. References
- Oculus Prime API:
services/api_edge_oculus_prime/README.md - Infrastructure Core:
infrastructure/edge/oculus_prime/core/README.md - Intake + Edge Plan:
docs/planning/INTAKE_EDGE_REFACTOR_INTEGRATION_PLAN_FEB16_2026.md - Jetpack Compose: https://developer.android.com/jetpack/compose
- CameraX: https://developer.android.com/training/camerax
- WorkManager: https://developer.android.com/topic/libraries/architecture/workmanager
- Retrofit: https://square.github.io/retrofit/
- Room: https://developer.android.com/training/data-storage/room
Appendix A: API Contract Examples
A.1 Upload Image Request (Android → Oculus Prime)
A.2 Upload Response
A.3 Health Check Response
Appendix B: Kotlin Code Snippets
B.1 Usage Example (Android App)
B.2 Background Sync Worker
End of Document