Advanced everything in Mobile Dev, page 7

What is Android Test Orchestrator and how does it isolate tests?
Tests process-level isolation in Android UI suites. A strong answer says it runs each test in its own Instrumentation process, stopping crashes or leaked state from cascading, and notes slower startup.

What is the role of TestDispatcher and runTest in coroutine testing?
This tests coroutine test infrastructure and virtual time control. A great answer says runTest installs a TestDispatcher and TestScope, skips delays automatically, and exposes advanceTimeBy to test timeouts instantly.

How would you implement and register a custom IdlingResource?
Implement the three IdlingResource methods with an atomic counter; register via IdlingRegistry in setup and unregister in teardown.

Android 12 foreground service restrictions and WorkManager expedited jobs
Tests Android 12 background-start limits. A great answer covers: the API 31 ban on background FGS starts, BOOT_COMPLETED exceptions, and WorkManager setExpedited with out-of-quota fallback. Red flag: starting an FGS in a BroadcastReceiver ignoring quota.

Replace a production NetworkService with a fake in Hilt instrumented tests
Tests whether you know Hilt test overrides beyond basic DI. A strong answer covers @BindValue for field-level fakes and @TestInstallIn or @UninstallModules for module swaps.
Configure OkHttp Cache for Retrofit and force network requests
This tests HTTP caching semantics in mobile networking. A strong answer covers Cache setup with a 50 MiB directory, server Cache-Control driving expiration, and CacheControl.FORCE_NETWORK to bypass.
Parse polymorphic media JSON with Kotlin sealed classes and custom serializers
Sealed Media with Image and Video; use Moshi Factory or kotlinx.serialization keyed on the type field.

How would you implement a robust offline-first repository?
Tests single-source-of-truth discipline and network-local sync. Outline a Room repository with Flow, background refresh, disk persistence, immediate local emission, and conflict resolution with retry.

Room DAO: Flow<List<User>> vs suspend fun getUsers(): List<User>
This tests reactivity versus one-shot queries in Room and coroutines. Flow emits on every table change on Room's dispatcher, while suspend returns a single snapshot requiring manual refresh.

How would you architect state-driven UI with ViewModel and Compose?
Tests unidirectional data flow and state hoisting. Model screen state as an immutable data class, expose StateFlow from ViewModel, and collect it in Compose so events flow up and state down. Red flag: exposing mutable state or putting logic in Composables.

How do you navigate between feature modules without direct dependencies?
This tests architectural decoupling in multi-module Android apps. A great answer describes a shared navigation contract or deep-link router that lets features stay independent. Recommending direct Gradle dependencies between features is a major red flag.

How would you architect two source Flows from ViewModel to data layer?
This tests merging parallel async streams into one reactive state. A strong answer uses combine on two cold repository Flows, exposes one UI state Flow from the ViewModel, and maps failures to error states. Red flag: using two coroutines mutating shared state.

Diagnose Compose recomposition issues and explain lambda stability
Tests Compose skipping and stability. Strong answers name recomposition counts, compiler metrics, and immutable state, then explain unremembered lambdas create new instances and prevent skipping.

Difference between remember and rememberSaveable
Remember survives recompositions only; rememberSaveable uses Bundle state for config changes and process death; use for UI state after recreation.
How does Android manage ContentProvider lifecycle and threading across processes?
Tests Android IPC and provider architecture. Strong answers explain lazy per-process instantiation via AMS, ContentResolver as the client binder proxy, and query executing on a binder thread. Red flag: claiming the provider runs in the caller process.

What happens to a bound service during config changes and multiple clients?
Tests bound service reference counting. Config change destroys the Activity binding; if no other clients exist, the service stops. Multiple clients keep it alive until the last unbind. Red flag: assuming the service survives config changes without a rebind.

Your app is killed for memory; what runs when the user returns?
Tests process death versus config change. Answer: no callback on kill; return runs onCreate with savedInstanceState, onStart, and onResume. ViewModels die in process death; use SavedStateHandle. Red flag: claiming onDestroy fires or ViewModels survive it.
How do you manage API keys across Gradle build variants securely?
Gitignore a properties file, load it in build.gradle, map secrets to BuildConfig or manifest placeholders by flavor, and commit safe defaults.

Which Android Studio Profiler tool diagnoses high memory usage and leaks?
Heap dump, check retained size for leaked Activities, trace reference chains to root retainer.

How would you implement a type-safe Kotlin DSL for a UI Form?
Tests Kotlin DSL scoping with lambda receivers and extensions. Strong answers sketch a Form builder using initTag, explain T.() -> Unit implicit this for child elements, and add DslMarker to block scope leaks. Red flag: describing it as simple method chaining.
We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.
See open roles