Skip to content
Preptima

Mobile engineering fundamentals

The vocabulary of building for iOS and Android: platform lifecycles, SwiftUI and Compose state models, coroutines and structured concurrency, offline sync, and the specific things that go wrong under memory pressure and on a real network.

59 questions

Go deeper on Mobile Engineering
Standard Sheet View

App lifecycle and platform vocabulary

What states can a mobile app actually be in?

Foreground/active, where the app is visible and receiving input; background, where it is still running but not visible, usually with a short grace period before it is suspended; and suspended or terminated, where the process is frozen or gone entirely. Both platforms give an app very little guaranteed time in the background before the OS reclaims memory from it, which is why anything that must finish - a network upload, a database write - has to either complete fast, register for a background-execution extension, or hand off to a durable job the OS can restart later. Treating "background" as a stable place to keep doing work is the single most common lifecycle mistake candidates describe from experience.

Walk me through what happens when a user backgrounds and returns to an app.

The app moves to background, may be given a short window to finish urgent work, and is then eligible for suspension - frozen in memory but not yet killed, so it can resume instantly with everything intact. Under memory pressure the OS may go further and terminate the process outright while the user is elsewhere, and there is no reliable callback promised at that exact moment, which is why state that must survive has to be persisted proactively rather than in a handler for termination. When the user returns after suspension, the app resumes exactly where it left off; when they return after termination, the OS relaunches the process from scratch and the app must reconstruct its state from whatever it actually saved.

What is the difference between a cold start and a warm start?

A cold start means the OS has to create the process from nothing - load the binary, initialise the runtime, run application startup code, then build the first screen - and it is the slowest and most visible startup path a user experiences. A warm start means the process already exists in memory, usually because the app was recently backgrounded rather than killed, so the OS just brings it back to the foreground and the app resumes from where it paused, skipping process and runtime initialisation entirely. The design consequence is that cold-start time is a metric worth actively managing - deferring non-essential initialisation, lazy-loading subsystems the first screen does not need - because it is the number that determines whether a user waits or bounces.

Why do interviewers ask about the manifest or Info.plist instead of just code?

Because these declarative files are where an app states its permissions, its capabilities, and its entry points to the operating system, and misconfiguring them causes failures that look nothing like the actual cause - a crash on launch that is really a missing permission declaration, a feature silently unavailable because a background mode was never declared. On Android the manifest declares components (activities, services, receivers), permissions, and hardware features the app requires; on iOS Info.plist declares similar territory - background modes, required device capabilities, and the usage-description strings the system shows the user when requesting a permission. Interviewers use this as a proxy for whether a candidate has actually shipped something past a tutorial, because these files only become familiar through hitting their errors.

What is deep linking, and what makes it fragile?

A deep link is a URL that opens the app directly to a specific screen rather than to its default entry point, and both platforms support it through URL schemes or, more robustly, through platform-verified web links (Universal Links on iOS, App Links on Android) that require a domain to publish a file proving it controls the association. It is fragile because the target screen must be reachable with only the information encoded in the URL - if opening it assumes prior navigation state or a logged-in session that a cold-started process does not yet have, the link either crashes the screen or silently falls back to the home screen. The correct test is opening every deep link from a fully killed process, not from within a running session, because that is the actual condition a marketing email or a push notification produces.

Show me the app-state transitions a mobile engineer actually has to design around.

Both platforms converge on roughly the same shape even though the exact callback names differ.

The edge to look at is Suspended --> NotRunning. It happens with no guaranteed notification to the app, silently, purely because the OS needed the memory for something else - usually another app the user switched to. Anything the app has not already persisted by that point is gone, and the app has no way to know in advance which backgrounding event will be the one that triggers it.

That is why state restoration is designed around "assume termination could happen at any background transition" rather than around a specific callback that fires right before it. On iOS, scene(_:willDeactivate:) and encoding restoration state happen well before termination is even a possibility. On Android, onSaveInstanceState and, for a ViewModel, writing into SavedStateHandle happen at essentially the same point - proactively, on every backgrounding, not reactively when death is imminent.

The other edge worth naming is Foreground --> Suspended skipping straight past any assumption of a long-lived background phase. A modern OS suspends an app quickly specifically to save battery, so "the app has a few minutes in the background to finish this" is not a safe design assumption on either platform; it is closer to a few seconds unless the work has specifically registered for extended execution.

What is the difference between an Activity and a Fragment, and why does the distinction matter for state?

An Activity is a single, focused screen with its own window and its own entry in the OS's back stack, while a Fragment is a reusable portion of UI and behaviour hosted inside an Activity, letting one activity host several fragments simultaneously or swap between them without recreating the activity itself. The distinction matters for state because a fragment's lifecycle is driven by its host activity's lifecycle but is not identical to it - a fragment can be destroyed and recreated (for instance when it leaves the back stack and later returns) independently of the hosting activity being recreated, so state owned by a fragment needs the same rotation-versus-process-death thinking applied at the fragment level, not just the activity level.