Android యాప్లు తరచుగా పూర్వ-నిర్ధారణ పనిని చేయవలసి ఉంటుంది — డేటా సమకాలీకరణ, అప్లోడ్లు, లేదా ఆవర్తన ఉద్యోగాల వంటి తక్షణ UI వెలుపల నడిపే పనులు. Android అనేక యంత్రాలను (WorkManager, Services, coroutines) వేర్వేరు ఉపయోగ కేసులతో, అదనంగా OS నుండి ముఖ్యమైన పరిమితులను అందిస్తుంది.
పూర్వ-నిర్ధారణ పని ఎంపికలు
COROUTINES (in a ViewModel scope) → for async work tied to the UI/screen (network calls,
loading data) — runs while the screen is active
WORKMANAGER → for DEFERRABLE, GUARANTEED background work that must complete (even if the
app closes or the device reboots): syncing, uploads, periodic tasks, retries
→ the RECOMMENDED solution for most persistent background work
FOREGROUND SERVICE → for ongoing, user-visible background work (music playback, navigation,
active tracking) — shows a persistent notification
SERVICES → general background components (largely superseded by WorkManager/coroutines
for most cases)
