You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Crash: streaming service does not call startForeground in time #186
Crash reported in the Play Console after tapping Continue on the start streaming dialog:
android.app.RemoteServiceException$ForegroundServiceDidNotStartInTimeException
Caused by android.app.StackTrace: Last startServiceCommon() call for this service was made here
at android.content.ContextWrapper.startForegroundService
at in.co.gorest.grblcontroller.ui.FileSenderTabFragment.lambda$startFileStreaming$4 (FileSenderTabFragment.java:199)
Cause
FileSenderTabFragment starts FileStreamerIntentService with startForegroundService(). Android then needs startForeground() within 10 seconds, and before the service stops.
The service calls startForeground() only deep in onHandleIntent, on the worker thread, after the setup. When no G-code file is found it returns early without calling it, the service stops, and Android kills the app. A worker thread that is busy or slow also misses the 10 seconds.
Fix
Call startForeground() first thing in onStartCommand, with the same notification (checking or streaming, and the file name), then hand the intent to IntentService.
Remove the two later startForeground() calls and their SDK_INT > N_MR1 checks, which are always true with minSdk 26.
Acceptance
Given the service starts with no file to stream, when it returns early, then the app does not crash, the "No gcode file selected" toast shows and the notification goes away.
The normal streaming and checking notifications look the same as before.
Fixed in PR #190 (branch fix/186-streaming-fgs-start-crash). Reproduced on the emulator with the old code and checked the fix there. Closes when the PR is merged.
The Android 10 RemoteServiceException from the Play Console (no message in the trace) is most likely the older form of this same crash. Its two known sources are this streaming start and the USB screen's startForegroundService() in onStart, which v2.61 already replaced (ed7501f). If the Play Console still shows it on v2.62 or later, it needs its message to look further.
Activity
zeevy commentedon Oct 10, 2026
Fixed in PR #190 (branch
fix/186-streaming-fgs-start-crash). Reproduced on the emulator with the old code and checked the fix there. Closes when the PR is merged.zeevy commentedon Oct 10, 2026
The Android 10
RemoteServiceExceptionfrom the Play Console (no message in the trace) is most likely the older form of this same crash. Its two known sources are this streaming start and the USB screen'sstartForegroundService()inonStart, which v2.61 already replaced (ed7501f). If the Play Console still shows it on v2.62 or later, it needs its message to look further.