Device: Nexus 5X
OS Version: Android 13
App Version: 2.0.19 (82)
Date: August 22, 2025, 15:22:48 GMT+03:00
Issue Description:
Our Flutter application is experiencing a ForegroundServiceDidNotStartInTimeException on Android 13 devices when using both Firebase Messaging and Intercom. This error specifically occurs when the Firebase Messaging background service (FlutterFirebaseMessagingBackgroundService) is initiated.
Android expects a foreground service to call Service.startForeground() within 5 seconds after Context.startForegroundService() is invoked. In our case, this timeout is occurring, leading to an application crash.
Key Detail from Logs:
Upon reviewing the crash logs, a significant detail observed is the activity on a thread named DefaultDispatcher-worker-3, which is related to the Intercom SDK. This thread shows operations involving okhttp3.Cache and io.intercom.android.sdk.AppIdentityInjector.initializeEvents.
DefaultDispatcher-worker-3:
at okhttp3.internal.io.FileSystem.<clinit>(FileSystem.kt:47)
at okhttp3.Cache.<init>(Cache.kt:167)
at io.intercom.android.sdk.api.ApiFactory.createConfigurableHttpClient(ApiFactory.kt:119)
at io.intercom.android.sdk.AppIdentityInjector.configurableHttpClient_delegate$lambda$1(AppIdentityInjector.kt:55)
...
at io.intercom.android.sdk.AppIdentityInjector$initializeEvents$1.invokeSuspend(AppIdentityInjector.kt:37)
…
We suspect that these Intercom-related background operations might be causing a resource contention or delay, preventing the Firebase service from calling startForeground() within the required 5-second window, thus leading to the timeout.
Request for Assistance:
We require your assistance in understanding and resolving this issue. Could you please provide guidance on the interaction between Intercom's background processes and other foreground service initiations (like Firebase Messaging)? Specifically, how can we prevent Intercom's background activities from delaying the timely startup of a foreground service?
Attached Logs: