An operational history with Foreground Services: how a mountain climbing app faced constraints
rakuishi株式会社ヤマップ
In YAMAP, a mountain climbing app we develop, we have been operating multiple Foreground Services with different foregroundServiceTypes—location tracking during climbs (location), offline map downloads (dataSync), and screen recording (mediaProjection)—for over 8 years. While Foreground Services allow asynchronous execution of tasks while displaying notifications in the status bar, constraints have continuously increased with each OS version since startForegroundService() was introduced in Android 8. Mandatory foregroundServiceType (Android 10), prohibition of launches from the background (Android 12), mandatory declaration in Play Console (Android 14), 6-hour timeout for dataSync (Android 15), and silent failure of background audio control coming in Android 17... In this session, based on practical operational knowledge from a real product that cannot be seen from official documentation alone, we will cover everything from organizing Android asynchronous operations (Worker, ForegroundService), to the history and implementation of Foreground Services from Android 8 to the present, and how we solved rejections and crashes encountered in actual operation. (Translated by the DroidKaigi Committee)
Intended audience
- Those who want to get an overview of Foreground Service - Those who are struggling with choosing between Worker and Foreground Service - Developers of apps that handle long-running background processing, such as location or media processing