mrkiani.comفارسی
← back to engineering log
AndroidFintechEMVC#KotlinEmbedded
Published: 2026-08-14 · 6 min read

Architecting Sub-50ms Transaction Pipelines for 10,000+ Android POS Terminals

Deep dive into EMV kernel integration, asynchronous binary protocols over cellular networks, and offline SQLite WAL buffer synchronization.

Mohammad Kiani
Mohammad Kiani
Senior Full-Stack & Android Engineer
In production fintech deployments across thousands of handheld Android POS devices, standard REST APIs and JSON serialization create unacceptable latencies on volatile cellular networks (2G/3G/4G handoffs).

1. The Binary Frame Protocol

Replacing standard JSON payloads with fixed-width TLV (Tag-Length-Value) encoded binary frames reduced our over-the-air packet size from 2.4KB to 184 bytes per transaction. The binary encoder packs cryptographic authentication tokens and transaction amounts into dense bitfields.

2. Dual-Engine Architecture

We decoupled the Android UI Layer from the Hardware EMV Daemon via high-performance Android IPC (AIDL with shared memory). This isolation ensures that hardware crypto operations (SAM card, HSM keys) execute in real-time priority threads without garbage collector pauses.

3. Fault-Tolerant Offline WAL Buffer

When cellular connectivity drops mid-transaction, our custom engine commits to an encrypted local SQLite WAL with cryptographic nonces. As soon as the signal reconnects, an exponential-backoff sync worker safely drains the queue with idempotency guarantees, preventing double charges and race conditions.
Tagged under
AndroidFintechEMVC#KotlinEmbedded
Discuss This Architecture →