skip to content

Native Android

Android apps end to end: Compose or View UI, lifecycle, Hilt or Koin injection, Room and DataStore storage, WorkManager and SDK tooling. Interviewers map the role here, then drill into one layer.

on this pageshow

explore

questions

267 · 18 sections

In Compose, how do animateDpAsState and animateColorAsState animate a bouquet price badge, and what happens when the target changes mid-animation?

level: juniorimportance: must knowfreq 78%
basics
~20 s

animateDpAsState and animateColorAsState take a target value and return a State that moves toward it each frame under a spring by default. A new target mid-flight redirects the running animation from its current value and velocity.

open as a page

In Compose, how does AnimatedVisibility slide an order summary in and out, and why does a plain if-statement not animate its removal?

level: juniorimportance: must knowfreq 74%
basics
~20 s

AnimatedVisibility runs an EnterTransition when visible becomes true and an ExitTransition when it becomes false, keeping the content composed until the exit finishes. An if-statement removes the content at once, so there is nothing left to animate.

open as a page

In Jetpack Compose, what does the @Composable annotation change about a function, and where may a composable be called from?

level: juniorimportance: must knowfreq 80%
basics
~20 s

@Composable changes a function's type: the Compose compiler passes an implicit composition context into it, so it can only be called from another composable function or composable lambda, never from onClick, a coroutine or an ordinary function.

open as a page

In Jetpack Compose Material 3, how does MaterialTheme supply colors, typography and shapes to components, and how should a composable read them?

level: juniorimportance: must knowfreq 72%
basics
~20 s

MaterialTheme takes a ColorScheme, a Typography and a Shapes and provides them to everything in its content. Material components use them as defaults, and your own composables read MaterialTheme.colorScheme, .typography and .shapes instead of hardcoding values.

open as a page

In Jetpack Compose, why does Modifier.padding(16.dp).background(Color.Red) render differently from Modifier.background(Color.Red).padding(16.dp)?

level: juniorimportance: must knowfreq 72%
basics
~10 s

Each modifier wraps everything after it. Padding then background insets first, so red fills only the inner area; background then padding paints the whole padded area red, then insets the content.

open as a page

In Jetpack Lifecycle, what are the Lifecycle.State and Lifecycle.Event values, and how does each event move an owner between states?

level: juniorimportance: must knowfreq 62%
basics
~10 s

Lifecycle.State has five values, DESTROYED, INITIALIZED, CREATED, STARTED and RESUMED; Lifecycle.Event has ON_CREATE through ON_DESTROY plus ON_ANY. Each event moves the owner one step: ON_PAUSE back to STARTED, ON_STOP back to CREATED.

open as a page

In a Jetpack ViewModel, why does screen state survive a rotation, and when does the ViewModelStore finally clear the ViewModel?

level: juniorimportance: must knowfreq 82%
basics
~20 s

A ViewModel lives in its owner's ViewModelStore, which survives a configuration change, so the recreated Activity gets the same instance back. The store clears it, calling onCleared, only when the owner ends for good, such as a finished Activity or a popped navigation entry.

open as a page

In Jetpack Lifecycle, why is launchWhenStarted deprecated in favour of repeatOnLifecycle(Lifecycle.State.STARTED), and what does each do when the screen stops?

level: middleimportance: must knowfreq 72%
basics
~20 s

launchWhenStarted only suspends its block on a pausing dispatcher when the screen stops, so a flow's producer keeps running and wastes resources. repeatOnLifecycle(STARTED) cancels the block on ON_STOP and relaunches it on ON_START; launchWhenX is deprecated since Lifecycle 2.6.0.

open as a page

In a Jetpack ViewModel, how does SavedStateHandle keep a half-filled car-rental booking form across process death, and what are its limits?

level: middleimportance: must knowfreq 74%
basics
~20 s

SavedStateHandle is a key-value map the ViewModel receives in its constructor; it is written into the owner's saved state when the Activity stops and restored after process death. It holds only Bundle-compatible values, and loses them when the user removes the task.

open as a page

With Jetpack Lifecycle, how do you build a GPS boarding-gate checker as a DefaultLifecycleObserver, and what does a late addObserver call deliver?

level: middleimportance: should knowfreq 45%
basics
~10 s

Implement DefaultLifecycleObserver, override onStart to begin GPS checks and onStop to end them, then call lifecycle.addObserver(checker). Added late, the observer is replayed every event up to the current state, in order.

open as a page

In RecyclerView, what does onCreateViewHolder do versus onBindViewHolder, and why must every bind reset each view it sets?

level: juniorimportance: must knowfreq 80%
basics
~20 s

onCreateViewHolder inflates a row layout and caches its child views in a new ViewHolder; onBindViewHolder writes one item's data into an existing, possibly recycled holder. A recycled holder keeps the last item's state, so each bind must set every view.

open as a page

With RecyclerView's ListAdapter, how do DiffUtil.ItemCallback and submitList replace notifyDataSetChanged, and why can an update silently fail to appear?

level: middleimportance: must knowfreq 80%
basics
~20 s

ListAdapter diffs each submitted list against the current one on a background thread using DiffUtil.ItemCallback, then dispatches precise insert, remove, move and change events. Resubmitting the same mutated list instance is ignored, so no update is dispatched.

open as a page

In RecyclerView, how do getItemViewType and GridLayoutManager's SpanSizeLookup together make section headers span a tablet grid's full width?

level: middleimportance: should knowfreq 55%
basics
~10 s

getItemViewType tells the adapter which layout and ViewHolder each position uses, so headers and books get different holders. GridLayoutManager's SpanSizeLookup then returns the full span count for header positions and one span for books.

open as a page

In a vertical RecyclerView with horizontal carousels nested in its rows, how do a shared RecycledViewPool and setInitialPrefetchItemCount stop the scroll hitch?

level: seniorimportance: should knowfreq 40%
basics
~20 s

Each nested RecyclerView otherwise has its own empty pool and inflates cards when its row appears. Sharing one RecycledViewPool lets carousels reuse card holders, and setInitialPrefetchItemCount makes prefetch build the visible cards before the row scrolls in.

open as a page

In a RecyclerView whose rows show live download progress, why does each ListAdapter update make the row flicker, and how do change payloads fix it?

level: seniorimportance: should knowfreq 40%
basics
~20 s

Without a payload, DefaultItemAnimator binds the change into a second ViewHolder and cross-fades the two, so each progress tick flashes the row. Returning a payload from getChangePayload lets RecyclerView reuse the same holder for a partial bind.

open as a page

In LiveData, what does it mean that an observer registered with observe(this, observer) in an activity is lifecycle-aware?

level: juniorimportance: must knowfreq 75%
basics
~10 s

LiveData calls an observer registered with observe(owner, observer) only while the owner is STARTED or RESUMED, gives it the latest value when it becomes active, and removes it automatically when the owner reaches DESTROYED.

open as a page

With MutableLiveData, when do you call setValue versus postValue, and what happens to values posted in quick succession?

level: middleimportance: must knowfreq 72%
basics
~20 s

setValue must run on the main thread and notifies active observers immediately. postValue works from any thread and schedules the update on the main thread; posts made before that task runs collapse, so only the last value arrives.

open as a page

In a fragment, why observe LiveData with viewLifecycleOwner rather than the fragment itself, and when does observeForever need removeObserver?

level: middleimportance: must knowfreq 64%
basics
~20 s

A fragment outlives its view on the back stack, so observers bound to the fragment pile up and touch dead views; viewLifecycleOwner removes them in onDestroyView. observeForever is never removed automatically, so every such observer needs its own removeObserver call.

open as a page

In LiveData, how do map and switchMap differ, and when would you add distinctUntilChanged to the chain?

level: middleimportance: should knowfreq 55%
basics
~20 s

map applies a function to each value; switchMap's function returns a LiveData, and the result follows only the latest one returned. distinctUntilChanged drops values equal to the last one, because setValue never compares and would re-run observers.

open as a page

After a rotation, a LiveData-driven order-tracking screen shows its 'Order cancelled' snackbar again; why does LiveData redeliver it, and how do you fix it?

level: seniorimportance: should knowfreq 58%
basics
~20 s

LiveData keeps its last value and delivers it to every new observer once started, so the recreated activity shows the message again. Handled-flag event wrappers were the old fix; today the message is UI state the ViewModel clears once shown.

open as a page

In Hilt, what do @HiltAndroidApp and @AndroidEntryPoint do, and what fails when an injected fragment's host activity lacks @AndroidEntryPoint?

level: juniorimportance: must knowfreq 80%
basics
~20 s

@HiltAndroidApp on the Application triggers Hilt's code generation and holds the app-wide SingletonComponent; @AndroidEntryPoint makes an activity, fragment, view, service or receiver injectable. A Hilt fragment inside a non-Hilt activity throws IllegalStateException when it is attached.

open as a page

In a Hilt module, when do you use @Binds versus @Provides, and how does @InstallIn decide where those bindings can be injected?

level: middleimportance: must knowfreq 78%
basics
~20 s

@Binds is an abstract method mapping an interface to an implementation Hilt can already build; @Provides has a body that constructs the instance, for third-party or builder-made types. @InstallIn names the Hilt component: bindings are visible there and in its child components.

open as a page

With Hilt, how does an Android screen obtain a @HiltViewModel, and why is injecting that ViewModel into an @Inject field rejected?

level: middleimportance: must knowfreq 75%
basics
~20 s

Annotate the ViewModel with @HiltViewModel and an @Inject constructor, then request it through the ViewModel APIs: by viewModels() in an @AndroidEntryPoint activity or fragment, or hiltViewModel() in Compose. Field injection fails the build because it bypasses the ViewModelStore.

open as a page

In Hilt, which scope fits an article cache shared by the ViewModels of one reader activity that must survive rotation, and why not @ActivityScoped or @Singleton?

level: seniorimportance: must knowfreq 62%
basics
~20 s

@ActivityRetainedScoped: ActivityRetainedComponent survives configuration changes and ends when the activity finishes, and ViewModels can see it. @ActivityScoped is rebuilt on every rotation, losing the cache; @Singleton keeps it for the whole process and shares it across every reader screen.

open as a page

In Hilt, how do you inject dependencies into a WorkManager worker and into a ContentProvider, two classes Hilt does not instantiate?

level: seniorimportance: should knowfreq 48%
basics
~20 s

A worker gets @HiltWorker and an @AssistedInject constructor with @Assisted Context and WorkerParameters, and WorkManager is configured with the injected HiltWorkerFactory. A ContentProvider declares an @EntryPoint interface installed in SingletonComponent and reads it through EntryPointAccessors.fromApplication().

open as a page

In Room, what does declaring a DAO function suspend change, and on which thread does its query run when called from the main thread?

level: juniorimportance: must knowfreq 70%
basics
~10 s

A suspend DAO function is main-safe: Room moves the query to its own coroutine context (Dispatchers.IO by default in Room 3.0, the query executor in Room 2.x) and resumes the caller with the result.

open as a page

In Room, how do @Insert, @Update, @Delete and @Query DAO functions differ, and what can each one return?

level: juniorimportance: must knowfreq 78%
basics
~20 s

@Insert, @Update and @Delete take entity objects and Room writes the SQL, matching rows by primary key; @Query runs SQL you write. Inserts can return the new rowid as Long, updates and deletes an Int row count.

open as a page

In Room, what does annotating a Kotlin data class with @Entity declare, and how does @Database tie the entities together?

level: juniorimportance: must knowfreq 80%
basics
~20 s

@Entity declares a SQLite table: one table per class, one column per persisted property, keyed by its @PrimaryKey. @Database lists those entity classes with a schema version, and Room's compiler generates the database that creates and checks the tables.

open as a page

In Room 3.0, how do you store an Instant property on an entity, and where do you register the converter that makes it work?

level: juniorimportance: must knowfreq 62%
basics
~10 s

Room 3.0 stores an Instant through two @ColumnTypeConverter functions, Instant to Long epoch millis and back, registered with @ColumnTypeConverters on the @Database class so every entity and DAO can use them.

open as a page

In Room, how does a DAO query returning Flow re-emit when a background sync inserts new messages, and why can it re-emit unchanged results?

level: middleimportance: must knowfreq 65%
basics
~20 s

Room tracks the tables a Flow query reads; after any write to one of them, it re-runs the whole query and emits the new result, even when the write touched rows outside it, so equal lists can arrive.

open as a page

In Preferences DataStore, how do you create the store, define typed keys, and read and write a reading app's theme and font size?

level: juniorimportance: must knowfreq 64%
basics
~10 s

Declare one top-level preferencesDataStore delegate, define keys with stringPreferencesKey or intPreferencesKey, read by mapping the data Flow (a missing key gives null), and write inside the suspending edit block on MutablePreferences.

open as a page

What was wrong with SharedPreferences that Jetpack DataStore was built to fix, and what does DataStore guarantee instead?

level: juniorimportance: must knowfreq 72%
basics
~20 s

SharedPreferences has a synchronous API that invites main-thread disk I/O, signals write failures poorly and can return unpersisted state. DataStore reads through a Flow and writes through suspending, serialized transactions that finish only once data is on disk.

open as a page

When would you choose a typed DataStore with a Serializer over Preferences DataStore, and how do updateData and data.first() behave there?

level: middleimportance: should knowfreq 46%
basics
~20 s

Choose typed DataStore when the data is a structured object that needs a schema and type safety. Its Serializer supplies defaultValue, readFrom and writeTo; updateData runs a serialized, atomic transform on an immutable value; data.first() takes one snapshot.

open as a page

In Jetpack DataStore, why does a second instance on the same file throw IllegalStateException, and how do you share one file across processes?

level: seniorimportance: should knowfreq 38%
basics
~20 s

DataStore allows one active instance per file in a process; a second one fails on its first read or write with "There are multiple DataStores active for the same file". Across processes, every process must use MultiProcessDataStoreFactory, one instance each.

open as a page

As the Android lead moving a shipped app from SharedPreferences to DataStore, how would you plan the migration and choose Preferences or typed DataStore as the team default?

level: principalimportance: should knowfreq 33%
basics
~20 s

Register a SharedPreferencesMigration in produceMigrations, keep key names and types identical, switch every reader in the same release because cleanUp deletes the old keys, and plan for rollback. Default to Preferences DataStore for flat settings, typed DataStore for structured objects.

open as a page

In Paging 3, what do a PagingSource and a Pager each do, and what can PagingSource.load() return?

level: juniorimportance: must knowfreq 72%
basics
~20 s

A PagingSource loads one page per load() call and returns LoadResult.Page, LoadResult.Error for a recoverable failure, or LoadResult.Invalid when its data changed. A Pager combines a PagingConfig with a PagingSource factory and exposes the loads as a Flow<PagingData>.

open as a page

In Paging 3, why does a ViewModel end its Pager.flow chain with cachedIn(viewModelScope), and where do map and insertSeparators go relative to it?

level: middleimportance: must knowfreq 62%
basics
~20 s

cachedIn(viewModelScope) shares the PagingData stream and keeps its loaded pages alive in the ViewModel, so a rotated screen gets them back instead of reloading. Put map, filter and insertSeparators before it so their results are cached too.

open as a page

In Paging 3, what does PagingSource.getRefreshKey() decide, and how do you implement it for a page-numbered wine catalogue API?

level: middleimportance: should knowfreq 48%
basics
~20 s

getRefreshKey() picks the key a new generation's first load starts from after an invalidation, so the list reloads where the user is. For page numbers, take the page closest to state.anchorPosition and return prevKey + 1 or nextKey - 1.

open as a page

In Paging 3, how does a RemoteMediator fill a Room cache for an offline wine catalogue, and how do newly fetched wines reach the list?

level: seniorimportance: should knowfreq 38%
basics
~20 s

The Pager reads only from Room's PagingSource; when it reaches an end or a refresh is requested, Paging calls RemoteMediator.load(), which fetches a page and writes it to the database. That write invalidates the PagingSource, so a new generation shows the wines.

open as a page

In Retrofit 3, what may a suspend service method return, and why does Retrofit reject one declared to return Call<T>?

level: juniorimportance: must knowfreq 75%
basics
~10 s

A Retrofit 3 suspend method returns the body type T, Response<T> when status and headers matter, or Unit to discard the body. Call<T> is rejected because a suspend method already runs its call asynchronously.

open as a page

In Retrofit 3, what does a converter factory do, and what happens if a service method returns a data class with none registered?

level: juniorimportance: must knowfreq 70%
basics
~20 s

A Retrofit converter factory turns a successful response body into the declared type and a @Body value into a request body. With none added, only ResponseBody, RequestBody, Unit and Void work; a data class fails with "Unable to create converter".

open as a page

With Retrofit, what happens on an HTTP 404 when a suspend service method returns User instead of Response<User>?

level: juniorimportance: must knowfreq 75%
basics
~20 s

Returning User, the suspend method throws HttpException on a 404, since it can only hand back a body. Returning Response<User>, it returns normally and you check isSuccessful, code() and errorBody(); a network failure throws either way.

open as a page

In Retrofit, how do you declare a service method that uploads a profile photo file together with a text caption?

level: juniorimportance: must knowfreq 55%
basics
~10 s

Annotate the method with @Multipart and a body-carrying verb such as @POST, pass the photo as @Part MultipartBody.Part built by createFormData with a filename, and pass the caption as @Part("caption") RequestBody.

open as a page

Why does Retrofit.Builder reject a baseUrl such as https://tracker.example.com/api/v2, and how do endpoint paths resolve against a base URL?

level: juniorimportance: must knowfreq 65%
basics
~20 s

A baseUrl with a path must end in a slash, or relative endpoints would replace its last segment; Retrofit.Builder throws IllegalArgumentException otherwise. Endpoints resolve like web links: relative paths append, a leading slash keeps only the host, a full URL replaces it.

open as a page

In WorkManager, how do you schedule a photo upload that runs only on unmetered Wi-Fi while charging, and why not just launch a coroutine?

level: juniorimportance: must knowfreq 78%
basics
~10 s

Subclass CoroutineWorker, build a OneTimeWorkRequest whose Constraints require NetworkType.UNMETERED and charging, and enqueue it. WorkManager persists the request, so it survives process death and reboot; a plain coroutine dies with the process.

open as a page

In WorkManager, how do you run compress-then-upload as one unique chain, pass Data between the steps, and observe it from the UI?

level: middleimportance: must knowfreq 62%
basics
~10 s

Call beginUniqueWork(name, ExistingWorkPolicy, compress).then(upload).enqueue(); each step's output Data, at most 10 KB, becomes the next step's input. Observe the chain with getWorkInfosForUniqueWorkFlow(name), which emits every step's WorkInfo.

open as a page

In WorkManager, when the user taps Back up now on a large album, when do you use setExpedited with an OutOfQuotaPolicy, and when setForeground with ForegroundInfo?

level: seniorimportance: should knowfreq 48%
basics
~20 s

setExpedited suits short, user-important work that must start now; it uses a system quota and allows only network and storage constraints. setForeground runs a worker as a foreground service with a notification, for user-visible work that may exceed ten minutes.

open as a page

In WorkManager, a nightly cleanup runs as unique periodic work; how do the 15-minute floor, the flex interval and ExistingPeriodicWorkPolicy decide when it runs and which version runs?

level: seniorimportance: should knowfreq 52%
basics
~20 s

PeriodicWorkRequest clamps intervals under 15 minutes to 15 with a log warning, and a flexInterval of at least 5 minutes confines runs to the end of each period. ExistingPeriodicWorkPolicy.UPDATE applies a new spec without resetting the schedule; KEEP keeps the old one.

open as a page

In WorkManager without Hilt, how do you give a worker constructor dependencies through a custom WorkerFactory, and how do you test that worker?

level: seniorimportance: should knowfreq 38%
basics
~10 s

Subclass WorkerFactory, build your worker in createWorker (return null to fall back to the default), set it with Configuration.Builder.setWorkerFactory from an Application implementing Configuration.Provider, and remove WorkManagerInitializer from the manifest. Test with TestListenableWorkerBuilder.setWorkerFactory.

open as a page

In Jetpack Benchmark, how does a Microbenchmark with BenchmarkRule differ from a Macrobenchmark with MacrobenchmarkRule, and why run them on a physical device?

level: juniorimportance: should knowfreq 42%
basics
~20 s

A Microbenchmark loops one hot function inside the test process with BenchmarkRule; a Macrobenchmark drives the installed app from a separate test module to time startup or frames. Emulators measure the host, so both report an error.

open as a page

In Jetpack Macrobenchmark, how do CompilationMode.None, Partial and Full differ, and which mode does measureRepeated use when you pass none?

level: middleimportance: should knowfreq 30%
basics
~20 s

None resets compilation so code runs JIT-only, the worst case; Partial pre-compiles with the Baseline Profile or warmup runs, like a store install; Full compiles everything ahead of time. The default is Partial with BaselineProfileMode.UseIfAvailable on API 24+.

open as a page

In a Jetpack Macrobenchmark, how do StartupMode.COLD, WARM and HOT change each iteration, and what do StartupTimingMetric's two values measure?

level: middleimportance: should knowfreq 38%
basics
~20 s

COLD kills the process before every measured launch, WARM keeps the process but recreates the activity, HOT brings the existing activity forward. StartupTimingMetric reports timeToInitialDisplayMs to the first frame and timeToFullDisplayMs to the app's fully-drawn signal.

open as a page

After a dependency upgrade slowed cold start, how do you generate a Baseline Profile with BaselineProfileRule and the androidx.baselineprofile plugin, then verify it helped?

level: seniorimportance: should knowfreq 40%
basics
~10 s

Record startup with BaselineProfileRule.collect in a com.android.test module, let the androidx.baselineprofile plugin copy the rules into the app's source set, ship ProfileInstaller, then compare a cold-start Macrobenchmark under CompilationMode.None() and Partial(BaselineProfileMode.Require).

open as a page

A news feed janks on scroll; how would you write a Jetpack Macrobenchmark with FrameTimingMetric and TraceSectionMetric to prove a fix, and how do you read its results?

level: seniorimportance: should knowfreq 32%
basics
~20 s

Scroll the feed in a Macrobenchmark's measureBlock with FrameTimingMetric and a TraceSectionMetric around the row code. Compare P90 to P99 frameOverrunMs, where positive values are dropped frames, plus the section's count and total, before and after.

open as a page

How do you add LeakCanary 2 to an Android app, and why does it go in debugImplementation with no setup code?

level: juniorimportance: must knowfreq 62%
basics
~10 s

Add com.squareup.leakcanary:leakcanary-android:2.14 as a debugImplementation dependency and write no code: a ContentProvider merged from the library installs it at startup, and keeping it debug-only matters because it refuses to run in a non-debuggable build.

open as a page

After rotating a screen several times, LeakCanary reports a leaked activity; how do you read its leak trace to find the reference to fix?

level: middleimportance: must knowfreq 55%
basics
~20 s

Read the leak trace from the GC root down to the destroyed activity. Objects are marked Leaking: NO, UNKNOWN or YES; the underlined suspects lie between the last NO and the first YES, and the one never cleared is the bug.

open as a page

What does LeakCanary 2 watch automatically, when does a watched object count as retained, and when does it dump the heap?

level: middleimportance: must knowfreq 50%
basics
~20 s

LeakCanary 2 watches destroyed activities, fragments, fragment views and services, cleared ViewModels and detached root views. One still reachable 5 seconds later, after a GC, is retained; it dumps the heap at 5 retained while visible, 1 in the background.

open as a page

How does LeakCanary tell a Library Leak from an Application Leak, and what do you do when a third-party SDK keeps leaking your activity?

level: seniorimportance: should knowfreq 30%
basics
~20 s

LeakCanary matches each trace against known leak patterns, AndroidReferenceMatchers by default; a leak whose only path runs through a matched reference is a Library Leak. For a leaking SDK, report it upstream and add your own matcher meanwhile.

open as a page

With LeakCanary, how do you make Android instrumentation tests fail on memory leaks, and why does the rule's position in a RuleChain matter?

level: seniorimportance: should knowfreq 32%
basics
~20 s

Add leakcanary-android-instrumentation as an androidTestImplementation dependency and use the DetectLeaksAfterTestSuccess rule or call LeakAssertions.assertNoLeaks(). Placed outside the activity rule it catches activity leaks; inside, it catches fragment leaks that vanish once the activity is destroyed.

open as a page

In an Android Activity, which lifecycle callbacks run, and in what order, when the user rotates the device, presses Home, and presses Back?

level: juniorimportance: must knowfreq 85%
basics
~20 s

Rotation destroys and recreates an Activity: onPause, onStop, onDestroy, then onCreate, onStart, onResume on a new instance. Home runs onPause and onStop and keeps it. Back adds onDestroy, except on a root launcher activity on Android 12+.

open as a page

With adb, how do you get logs off a misbehaving Android device and narrow logcat to your own tags and priorities?

level: juniorimportance: must knowfreq 68%
basics
~20 s

List devices with adb devices, target one with -s, then run adb logcat with tag:priority filters ending in *:S so only your tags print; read the crash buffer for stack traces and take adb bugreport for a full capture.

open as a page

In an Android app module's build file, what do compileSdk, minSdk and targetSdk each control, and how do they relate?

level: juniorimportance: must knowfreq 72%
basics
~10 s

compileSdk sets which Android APIs your code compiles against, minSdk sets the oldest Android version that can install the app, and targetSdk declares which version's runtime behaviour the app was tested for.

open as a page

On Android, what is the difference between an explicit and an implicit intent, and how does the system resolve an implicit one?

level: juniorimportance: must knowfreq 75%
basics
~20 s

An explicit intent names the component to start, so Android delivers it there directly; an implicit intent describes an action, data and categories, and Android matches it against installed apps' intent filters, letting the user pick when several match.

open as a page

In the Android Keystore, where should the key that encrypts a session token live now that EncryptedSharedPreferences is deprecated, and what does the app hold?

level: juniorimportance: must knowfreq 72%
basics
~20 s

Generate the key inside the AndroidKeyStore provider, which security-crypto 1.1.0 points to after deprecating EncryptedSharedPreferences. The app holds only a SecretKey handle: the Keystore performs each encryption outside the app's process and never exports the key material.

open as a page

What is Google Play services on an Android device, and why should an app check it with GoogleApiAvailability before calling its APIs?

level: juniorimportance: must knowfreq 55%
basics
~20 s

Google Play services is a Google app on certified Android devices that runs the implementation behind thin client libraries for location, Maps and sign-in. Devices without the Play Store lack it, so apps check isGooglePlayServicesAvailable and offer a fix or fallback.

open as a page

With Google Play services' FusedLocationProviderClient, when do you use getCurrentLocation instead of requestLocationUpdates, and what does a LocationRequest's Priority change?

level: middleimportance: must knowfreq 60%
basics
~20 s

Use getCurrentLocation for one fresh fix and requestLocationUpdates only for a continuous stream, which you must stop with removeLocationUpdates. The LocationRequest's Priority tells the fused provider how much accuracy to trade for battery, from PRIORITY_HIGH_ACCURACY down to PRIORITY_PASSIVE.

open as a page

In the Play In-App Update library, how do flexible and immediate updates differ, and how do updatePriority and clientVersionStalenessDays help you choose between them?

level: middleimportance: should knowfreq 45%
basics
~20 s

A flexible update downloads in the background while the user keeps working, and the app calls completeUpdate to install it. An immediate update blocks the app until Play installs and restarts it. updatePriority (0-5) and clientVersionStalenessDays decide which to request.

open as a page

With Credential Manager on Android, how do you implement Sign in with Google, and what should the app do when getCredential throws NoCredentialException?

level: seniorimportance: should knowfreq 45%
basics
~20 s

Wrap a GetGoogleIdOption in a GetCredentialRequest, call CredentialManager.getCredential, turn the returned CustomCredential into a GoogleIdTokenCredential and send its idToken to the server to verify. On NoCredentialException, retry without authorized-account filtering to offer sign-up, then fall back to regular sign-in.

open as a page

With the Play Integrity API, how does a standard request differ from a classic one, and how do requestHash and nonce bind a verdict to one action?

level: seniorimportance: should knowfreq 35%
basics
~20 s

A standard request warms up a token provider once, then returns tokens in a few hundred milliseconds, replay-protected by Google Play. A classic request recomputes everything and relies on your nonce. requestHash or nonce carries a request digest the server recomputes.

open as a page

In Google Play Console, what are the internal, closed, open and production tracks, and who can install a build from each?

level: juniorimportance: must knowfreq 62%
basics
~20 s

Play Console has four tracks: internal testing (up to 100 listed testers), closed testing (testers invited by email list, Google Group or organization), open testing (any Google Play user can join) and production (all Google Play users in your chosen countries).

open as a page

With Play App Signing, how do the upload key and the app signing key differ, and why does an Android App Bundle need it?

level: middleimportance: must knowfreq 55%
basics
~20 s

You sign the bundle with an upload key proving it is yours; Google Play holds the app signing key and signs the per-device APKs it generates. A bundle defers APK generation and signing to Play, so Play must hold that key.

open as a page

In Play Console, how do you run, raise, halt and resume a staged rollout of an app update, and what does each step do to users?

level: middleimportance: must knowfreq 58%
basics
~20 s

A staged rollout serves an update to a random share of users that you raise by hand. Halting stops new users getting it while those who updated keep it; resuming reaches the same users, and fixes ship as new releases.

open as a page

On Google Play, a fintech update targets API 35 and its Data safety form omits an analytics SDK's data; what does each rule require as of October 2026?

level: seniorimportance: should knowfreq 42%
basics
~20 s

From August 31, 2026, phone app updates must target Android 16 (API 36) to be submitted. The Data safety form must declare all user data the app collects or shares, including data its third-party SDKs send off the device.

open as a page

As an Android lead, how would you structure your team's Play Console tracks and promotion rules: who gets which build, and what moves a release up?

level: principalimportance: should knowfreq 28%
basics
~20 s

Give each track an audience and an exit rule: builds to internal testing, candidates to closed testing, open testing only if a public beta fits, then staged production. Promote the same bundle only on agreed signals like vitals and hold times.

open as a page

What is Firebase App Distribution for, and how does an invited tester get a pre-release Android build onto a device?

level: juniorimportance: should knowfreq 35%
basics
~20 s

Firebase App Distribution gets pre-release Android and iOS builds to named testers. You upload a build, choose testers or groups, add release notes and Distribute; testers accept the emailed invitation with a Google Account and install from the App Tester app.

open as a page

In Firebase App Distribution, how does CI upload a nightly Android build to tester groups with release notes, via the CLI or Gradle plugin?

level: middleimportance: should knowfreq 30%
basics
~10 s

CI runs firebase appdistribution:distribute with --app, --groups and --release-notes-file, or the Gradle plugin's appDistributionUploadRelease task configured in a firebaseAppDistribution block, both authenticated with a service account holding the Firebase App Distribution Admin role.

open as a page

In Firebase App Distribution, an iOS tester accepted the invite but cannot install your ad hoc build; what is missing and how do you fix it?

level: seniorimportance: should knowfreq 25%
basics
~20 s

The device's UDID is not in the ad hoc provisioning profile. Export the registered UDIDs from App Distribution, add the devices in the Apple developer account and to the profile, rebuild with the same version and build number, and redistribute.

open as a page

As a lead, would you make Firebase App Distribution or Play's internal testing track the team default for Android pre-release builds, and why?

level: principalimportance: should knowfreq 30%
basics
~20 s

Usually App Distribution for day-to-day builds and Play's internal testing track for release candidates. App Distribution takes any signed variant on both platforms for up to 500 testers; the internal track delivers the store-signed bundle through Google Play to at most 100.

open as a page

In Espresso, what do onView, perform and check each do, and what happens when the matcher finds no view or several views?

level: juniorimportance: must knowfreq 72%
basics
~10 s

onView takes a ViewMatcher that must match exactly one view, perform runs ViewActions such as click() on it, and check applies a ViewAssertion such as matches(isDisplayed()). No match throws NoMatchingViewException; several matches throw AmbiguousViewMatcherException.

open as a page

Before each Espresso action or assertion, what does Espresso wait for on its own, what work can it not see, and why turn animations off?

level: middleimportance: must knowfreq 58%
basics
~20 s

Espresso waits until the main message queue has nothing due, no AsyncTask runs and all registered idling resources are idle. Your own threads, executors and coroutine dispatchers are invisible to it; animations go off because they cause flakiness.

open as a page

An Espresso login test passes locally but flakes on CI while the sign-in network call completes; how do you fix it with an IdlingResource?

level: seniorimportance: must knowfreq 50%
basics
~20 s

The sign-in call runs off the main thread, so Espresso asserts before the response arrives. Wrap the call in a CountingIdlingResource (increment before, decrement in finally), register it with IdlingRegistry in @Before and unregister it in @After.

open as a page

In Espresso, when do you use onData instead of onView, and how do you click an off-screen RecyclerView row with RecyclerViewActions?

level: middleimportance: should knowfreq 45%
basics
~20 s

Use onData for AdapterView lists such as ListView, GridView and Spinner: it matches the adapter's data object and loads that row before acting. RecyclerView is not an AdapterView, so you call onView on the RecyclerView and perform a RecyclerViewActions action from espresso-contrib.

open as a page

As Android lead, how large a share of UI tests should be Espresso tests, and do you standardise on idling resources or injected idling-aware dispatchers for synchronisation?

level: principalimportance: should knowfreq 22%
basics
~20 s

Keep Espresso for flows that need a real View hierarchy on a device and pin everything else lower. For synchronisation, pick one team standard: injected idling-aware executors cover most background work automatically, CountingIdlingResource covers the rest explicitly, and sleeps are banned.

open as a page

With Media3's ExoPlayer, how do you play a lesson's HLS video in a PlayerView, and when and why must you release the player?

level: juniorimportance: must knowfreq 70%
basics
~20 s

Build an ExoPlayer with ExoPlayer.Builder, set it on a PlayerView, give it a MediaItem for the .m3u8 URI (needs the HLS module), then prepare() and play(). Release it when the screen stops: it holds decoders other apps need.

open as a page

In Media3, how do MediaSession and MediaSessionService keep a lesson's audio playing with the screen off and give the learner system playback controls?

level: middleimportance: must knowfreq 60%
basics
~20 s

Move the ExoPlayer into a MediaSessionService subclass, wrap it in a MediaSession returned from onGetSession, and declare the service with foregroundServiceType mediaPlayback. Media3 runs it in the foreground with a media notification while playing; screens control it through a MediaController.

open as a page

In Media3, how does a Player.Listener follow a lesson playlist through buffering, ready, ended and item changes, and how should it handle a PlaybackException?

level: middleimportance: must knowfreq 55%
basics
~10 s

A Player.Listener gets onPlaybackStateChanged (IDLE, BUFFERING, READY, ENDED), onIsPlayingChanged and onMediaItemTransition with a reason. Errors arrive in onPlayerError as a PlaybackException with an errorCode, just before STATE_IDLE; recover by calling prepare() again.

open as a page

In Media3's ExoPlayer, how do you make lessons prefer the learner's chosen audio language and cap video at SD with TrackSelectionParameters?

level: middleimportance: should knowfreq 35%
basics
~10 s

Copy the player's TrackSelectionParameters with buildUpon(), call setPreferredAudioLanguage("es") and setMaxVideoSizeSd(), and assign the result back. These are constraints, so they work before prepare() and apply to every lesson in the playlist.

open as a page

In Media3, a learner downloads a course for a flight; how do DownloadManager, DownloadService and SimpleCache fit together, and why does a second SimpleCache on that folder crash?

level: seniorimportance: should knowfreq 32%
basics
~20 s

DownloadService wraps a DownloadManager that writes segments into a SimpleCache and records state in a DownloadIndex; playback reads that cache through a CacheDataSource.Factory. SimpleCache locks its folder, so a second instance throws IllegalStateException; keep one per process.

open as a page