Posts

Part 1: The Stateless Blueprint - Scaling Android Auth for 5M+ Users

Image
 Why traditional sessions fail at global scale and how Senior Engineers design resilient, JWT-based authentication for Fintech. Most Android engineers are proficient at building login screens. You take user credentials, pass them to a  /login  endpoint, receive a token, and move on. However, transitioning to an  Android authentication architecture  that supports  5 million+ users  — particularly in fintech — requires a fundamental shift. At this scale, even a 50ms cross-region lookup can compound into seconds of perceived latency across multiple API calls. The challenge isn’t the UI; it’s resilience, global latency, and cryptographic trust. This is Part 1 of our 9-part “Scaling Secure Android” series. We are moving beyond basic tutorials into Senior-level system design. 🛑 The Core Problem: Why Stateful Sessions Fail at Scale In a traditional “stateful” architecture, the authentication “state” lives on the server. The server creates a session ID, store...

LiveData Internals Explained: Why postValue Drops Data & How Lifecycle Awareness Works

Image
  A deep dive into ObserverWrapper, mVersion tracking, and why postValue() might be dropping your data. ⚡ TL;DR: The 60-Second Summary Lifecycle Awareness:  LiveData wraps observers in  LifecycleBoundObserver  to monitor  isAtLeast(STARTED) . postValue vs setValue:   postValue   coalesces  updates into a single batch; it drops intermediate values to avoid flooding the Main Thread. Sticky Behavior:  Managed via an internal  mVersion  counter compared against the observer’s  mLastVersion . Memory Safety:  Automatically removes observers in  DESTROYED  state (except for  observeForever ). Active Hooks:  Uses  onActive()  and  onInactive()  to manage resource-heavy data sources like Room or GPS. Most Android developers use  LiveData  daily as the default state holder in  MVVM architecture in Android . As a core part of  Android Architecture Components , it is designed...