How mosip/android-registration-client works
1. Repository shape
This is a Flutter-based MOSIP Registration Client with heavy Android native integration. The root lib/ directory contains the cross-platform UI and app flow, while android/ hosts several native Java libraries and the Android host app. The repo also includes iOS/macOS/Windows/Linux/web shells, but the architectural center of gravity is Android + Flutter.
2. Top-level runtime boundary
The user-facing app runs in Flutter/Dart. Platform-specific work is delegated through generated Pigeon channels into Android native code. The bridge layer is explicit in pigeon/ and the Android-side host API wiring in android/app/... and the native manager libraries under android/.
3. Flutter presentation layer
lib/ui/ contains the screen hierarchy for login, onboarding, registration, post-registration, packet export, settings, scanner, profile, and approval flows. lib/provider/ holds state orchestration for these screens, and lib/model/ defines the data structures passed through the UI. This layer is responsible for navigation, form state, and rendering across mobile/tablet layouts.
4. Platform service layer in Dart
lib/platform_spi/ defines abstract capabilities such as authentication, demographics, biometrics, packet, registration, transliteration, sync, and machine-key services. lib/platform_android/ provides the Android implementations that talk to native code. This makes the Flutter app largely platform-agnostic at the UI level while keeping device-specific behavior behind service interfaces.
5. Native Android host app
android/app/ is the main Android application shell. It contains MainActivity, a background upload service, and Dagger-style bootstrap modules/components. It also declares Android resources and manifests for runtime behavior. This layer is the entry point for Android OS integration, lifecycle handling, and background execution.
6. Client manager subsystem
android/clientmanager/ is the largest native subsystem and acts like the application’s business and infrastructure core. It includes:
- configuration/bootstrap (config/)
- local persistence (entity/, dao/, repository/, RoomModule, ClientDatabase)
- business services (service/, spi/)
- scheduled jobs (jobs/)
- HTTP APIs (api_services/)
- utility and crypto helpers (util/)
This module encapsulates most registration-client domain logic and data synchronization.
7. Data persistence boundary
The client manager persists local state in a Room database through entities, DAOs, and repositories. It stores user details, machine/configuration data, audit records, registration artifacts, sync job definitions, templates, location hierarchies, and other operational metadata. Local persistence is central because the client must operate reliably with intermittent connectivity and later sync state to backend services.
8. Backend and sync flows
Native API service classes and the Dart platform services communicate with MOSIP backend endpoints for authentication, global config, master data sync, registration, packet status, dashboard data, and related lookups. The architecture supports a synchronization model: data is captured locally, enriched with master/config data, and then uploaded or polled asynchronously via jobs and background services.
9. Registration and packet composition
Two dedicated native libraries support core domain workflows:
- android/packetmanager/ builds and manages registration packets, document/biometric payloads, packet structure, hashing, storage, and encryption-related handling.
- android/transliterationmanager/ handles transliteration logic for multilingual name/address capture.
These libraries feed the packet creation pipeline used by registration and export/upload flows.
10. Security and cryptography
android/keymanager/ manages key storage, certificate handling, crypto operations, and trust-related functions. It provides the cryptographic boundary for signing, verification, certificate retrieval, and secure local operations. On the Flutter side, secure storage and secure-screen utilities support device-level hardening and sensitive state handling.
11. Biometric capture and device integration
Biometric capture is designed as a hardware integration boundary. The repo includes a bundled biometric SDK artifact in android/clientmanager/src/main/assets/biosdk/ and a matchsdk AAR under android/matchsdk/. The app also references Mock SBI / Mock MDS style flows in docs, indicating that biometric device interaction is abstracted so the client can use either real hardware or test substitutes.
12. Background and scheduled processing
The client manager defines jobs such as config sync, packet status sync, audit cleanup, and registration deletion. The Android app also has an upload background service. Together these form the app’s asynchronous execution layer for deferred network work, housekeeping, and retryable operations when the device is idle or network availability changes.
13. Native-to-Flutter contract
The pigeon/ definitions and generated platform bindings are the contract between Flutter and Android. This boundary is important: Flutter screens call typed service abstractions, which map to Android native APIs for registration data, authentication, documents, biometrics, machine identity, and config. The architecture is intentionally split so that UI logic stays in Dart and device/backend mechanics stay in Java.
14. Testing and delivery
The repository has strong test coverage at multiple levels: Flutter widget/unit tests in test/, extensive JVM tests under each Android module, and a separate ui-test/ automation project for end-to-end flows. CI is handled through GitHub Actions workflows for Android and client builds. This suggests a layered architecture where UI, native libraries, and integration behaviors are validated independently.
15. Operational picture
End users interact with the Flutter UI; the UI requests data and actions through platform services; Android native modules perform secure local processing, device access, packet construction, and network sync; backend MOSIP services provide config, auth, and registration endpoints; and biometric hardware or mock devices supply capture inputs. The main architectural boundaries are UI vs native, local store vs remote services, and synchronous user interaction vs asynchronous job processing.
Main entry points: service Business services · clientmanager Client core · ui Screens · provider State layer
Components 21
Flutter app
Cross-platform UI, state, and platform-agnostic service contracts.
- App entry · Application startup and router wiring.
lib/main.dart - Routing · Top-level app routing and flow selection.
lib/app_router.dart - Screens · Primary UI flows for login, onboarding, registration, export, settings, profile, scanner, and approval.
lib/ui - State layer · Provider-based coordination for app screens and workflows.
lib/provider - Domain models · Flutter-side data structures used across UI and service boundaries.
lib/model - Service SPI · Platform-neutral service interfaces for auth, biometrics, packet, sync, config, and registration.
lib/platform_spi - Android adapters · Flutter-side implementations that bridge SPI calls into Android native code.
lib/platform_android - Bridge contract · Typed Flutter-to-Android API definitions and generated contract surface.
pigeon
Android native
Android host app and native business/service layers.
- Android host · Main Android application shell with activity, background service, and DI bootstrap.
android/app/src/main/java/io/mosip/registration_client - Host APIs · Android-side API handlers exposed to Flutter via generated bindings.
android/app/src/main/java/io/mosip/registration_client/api_services - Client core · Main native subsystem for config, persistence, services, jobs, and sync.
android/clientmanager/src/main/java/io/mosip/registration/clientmanager - Local DB · Room-backed persistence boundary for operational and registration state.
android/clientmanager/src/main/java/io/mosip/registration/clientmanager/config/ClientDatabase.java - Business services · Registration, login, master-data, packet, validation, onboarding, and sync services.
android/clientmanager/src/main/java/io/mosip/registration/clientmanager/service - Repositories · Repository layer mediating between DAOs, entities, and services.
android/clientmanager/src/main/java/io/mosip/registration/clientmanager/repository - DAOs · Room data access objects for local persistence tables and lookups.
android/clientmanager/src/main/java/io/mosip/registration/clientmanager/dao - Jobs · Scheduled sync, cleanup, and packet-status tasks.
android/clientmanager/src/main/java/io/mosip/registration/clientmanager/jobs - Backend APIs · Native service clients for MOSIP auth, config, master data, registration, and status operations.
android/app/src/main/java/io/mosip/registration_client/api_services
Native libraries
Specialized Android modules for packet, crypto, and transliteration.
- Key manager · Certificate, trust, and cryptographic operations with local key storage.
android/keymanager/src/main/java/io/mosip/registration/keymanager - Packet manager · Registration packet composition, hashing, storage, and encryption handling.
android/packetmanager/src/main/java/io/mosip/registration/packetmanager - Transliteration · Multilingual transliteration service used during capture and registration.
android/transliterationmanager/src/main/java/io/mosip/registration/transliterationmanager
Validation
Automated tests and end-to-end delivery checks.
- UI tests · Separate end-to-end automation project covering major user journeys.
ui-test/src/main/java/regclient
Connections 21
- App entry → Routing: starts · App entry initializes routing and top-level flow.
- Routing → Screens: navigates · Routing selects the active screen flow.
- Screens → State layer: reads state · Screens consume provider-managed workflow state.
- State layer → Domain models: maps data · UI state is shaped through shared data models.
- State layer → Service SPI: calls · Providers depend on platform-neutral service abstractions.
- Service SPI → Android adapters: implemented by · SPI contracts are fulfilled by Android-specific adapters.
- Android adapters → Bridge contract: bridges via · Dart adapters invoke typed native contracts.
- Bridge contract → Android host: delivers to · Generated channel bindings reach the Android host APIs.
- Android host → Host APIs: exposes · Host app wires native APIs and lifecycle entry points.
- Host APIs → Client core: delegates · Android host calls into the native client core.
- Client core → Local DB: persists in · Core services rely on Room-backed local storage.
- Client core → Business services: orchestrates · Core subsystem coordinates business services.
- Business services → Repositories: uses · Services access repositories for durable state.
- Repositories → DAOs: queries · Repositories read and write through DAOs.
- Business services → Backend APIs: syncs with · Services call backend-facing HTTP clients.
- Client core → Jobs: schedules · Background jobs handle sync and maintenance tasks.
- Business services → Key manager: uses crypto · Security-sensitive operations depend on key management.
- Business services → Packet manager: builds packets · Registration services rely on packet composition.
- Business services → Transliteration: transliterates · Language conversion supports registration capture.
- Android adapters → Business services: invokes · Flutter platform adapters reach the native service layer.
- Screens → UI tests: covered by · Major flows are exercised by the external UI automation suite.