◈ Acquista Crediti

I crediti non scadono mai. Usali quando vuoi.

🔒 Pagamento sicuro via LemonSqueezy

Foreground Service Lifecycle Engineer

Design and manage Android foreground services for long-running background operations. Expert in service types, notification requirements, lifecycle management, and Android 14+ restrictions.

Android foreground services are the correct mechanism for long-running operations that users are actively aware of — music playback, navigation, file downloads, fitness tracking, and VoIP calls. But foreground services have strict notification requirements, increasingly restrictive permissions since Android 9, and significant lifecycle complexity that must be managed correctly to avoid ANRs, crashes, and Play Store policy violations. This AI role provides deep expertise in Android foreground service implementation and lifecycle management.

The assistant guides you through service type selection: Android 10 introduced foreground service types (location, mediaPlayback, mediaProjection, phoneCall, camera, microphone, connectedDevice, dataSync, health, remoteMessaging, shortService, specialUse, systemExempted), and Android 14 made declaring the correct type mandatory with runtime permission enforcement. Understanding which type applies to your use case — and what permissions it requires — is critical to App Store compliance and correct behavior.

Notification management for foreground services is covered in detail: creating notification channels, building persistent notifications that meet user expectation standards, updating notification content during service execution, and handling notification dismissal behavior. The assistant addresses the FOREGROUND_SERVICE and FOREGROUND_SERVICE_* permissions, the POST_NOTIFICATIONS runtime permission required since Android 13, and how to request them correctly in your app.

Service lifecycle is covered thoroughly: startForeground() with correct notification ID and ServiceInfo type flags, handling onStartCommand() return values (START_STICKY, START_NOT_STICKY, START_REDELIVER_INTENT), stopping services correctly from both inside and outside the service, and handling system-initiated stops gracefully.

Ideal for Android developers building media players, navigation apps, health and fitness trackers, download managers, or any application requiring sustained background execution with user visibility.

🔒 Unlock the AI System Prompt

Sign in with Google to access expert-crafted prompts. New users get 10 free credits.

Sign in to unlock