Android Background Processing Flashcards
6 cards from real Android Development practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 6 Android Background Processing flashcards as text
What is a BroadcastReceiver in Android used for?
Answer: To listen for and respond to system-wide broadcast events
BroadcastReceiver allows apps to register interest in system or app-wide broadcast intents, such as connectivity changes or battery events.
Which coroutine builder launches a new coroutine and returns a Job?
Answer: launch
The launch coroutine builder starts a new coroutine that doesn't return a result, and returns a Job that can be used to cancel it.
What is the difference between async and launch coroutine builders?
Answer: async returns a Deferred with a result; launch returns a Job with no result
async returns a Deferred that holds a future result accessible via await(), while launch returns a Job with no result.
Which WorkManager work type is guaranteed to run even after a device reboot?
Answer: Both A and B
WorkManager persists both OneTimeWorkRequest and PeriodicWorkRequest to a database, ensuring they survive app restarts and device reboots.
What is a Flow in Kotlin coroutines?
Answer: An asynchronous stream of values that can be collected over time
Kotlin Flow is a cold asynchronous stream that sequentially emits multiple values over time, built on top of coroutines.
What is the lifecycleScope used for in Android?
Answer: A CoroutineScope tied to the lifecycle of an Activity or Fragment
lifecycleScope is a CoroutineScope extension on LifecycleOwner that automatically cancels coroutines when the lifecycle is destroyed.