geofence_service icon indicating copy to clipboard operation
geofence_service copied to clipboard

ForegroundServiceDidNotStartInTimeException - Context.startForegroundService() did not then call Service.startForeground()

Open qwadrox opened this issue 1 year ago • 0 comments

An error popped up in Crashtlytics on our production env. I opened a new issue for further investigation.

Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{...

Brand:Samsung Model:Galaxy Z Fold3 5G Version:Android 13

See StackTrace from Crashlytics
# Crashlytics - Stack trace
# Application: com.example.app
# Platform: android
# Version: 3.0.5 (577)
# Issue: 09bb529dadf96b173165f5972dd4308b
# Session: 6576CDC503420001716854EBA52ED2D8_DNE_0_v2
# Date: Mon Dec 11 2023 11:53:44 GMT+0300 (GMT+03:00)

Fatal Exception: android.app.RemoteServiceException$ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{8df5c85 u0 com.example.app/com.pravera.flutter_foreground_task.service.ForegroundService}
      at android.app.ActivityThread.generateForegroundServiceDidNotStartInTimeException(ActivityThread.java:2251)
      at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:2222)
      at android.app.ActivityThread.-$$Nest$mthrowRemoteServiceException()
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2518)
      at android.os.Handler.dispatchMessage(Handler.java:106)
      at android.os.Looper.loopOnce(Looper.java:226)
      at android.os.Looper.loop(Looper.java:313)
      at android.app.ActivityThread.main(ActivityThread.java:8810)
      at java.lang.reflect.Method.invoke(Method.java)
      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

Caused by android.app.StackTrace: Last startServiceCommon() call for this service was made here
      at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1988)
      at android.app.ContextImpl.startForegroundService(ContextImpl.java:1933)
      at android.content.ContextWrapper.startForegroundService(ContextWrapper.java:839)
      at q0.a$f.b()
      at q0.a.p()
      at com.pravera.flutter_foreground_task.service.a.d(:39)
      at ed.b.onMethodCall(:139)
      at ue.j$a.a(:17)
      at ie.c.l(:18)
      at ie.c.m(:40)
      at ie.c.i()
      at ie.b.run(:12)
      at android.os.Handler.handleCallback(Handler.java:942)
      at android.os.Handler.dispatchMessage(Handler.java:99)
      at android.os.Looper.loopOnce(Looper.java:226)
      at android.os.Looper.loop(Looper.java:313)
      at android.app.ActivityThread.main(ActivityThread.java:8810)
      at java.lang.reflect.Method.invoke(Method.java)
      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

Crashlytics Exception Handler1:
      at dalvik.system.VMStack.getThreadStackTrace(VMStack.java)
      at java.lang.Thread.getStackTrace(Thread.java:1841)
      at java.lang.Thread.getAllStackTraces(Thread.java:1909)
      at t9.v.z(:16)
      at t9.v.o(:4)
      at t9.v.j(:45)
      at t9.v.d(:44)
      at t9.u0.r(:19)
      at t9.u0.s(:32)
      at t9.r$b.a(:49)
      at t9.r$b.call()
      at t9.o$c.a(:2)
      at e8.x.run(:8)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
      at t9.b0$a$a.a(:2)
      at t9.e.run(:5)
      at java.lang.Thread.run(Thread.java:1012)

qwadrox avatar Dec 11 '23 11:12 qwadrox