Foregroundservice using intentservice crash

Crash Log :

android.app.RemoteServiceException: Context.startForegroundService()
did not then call Service.startForeground(): ServiceRecord{71078e3 u0
com.adityabirlahealth.insurance/.googlefit.GoogleFitLocalSyncService}
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1760)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6806)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)

I am using ContextCompat.startForegroundService(ActivHealthApplication.getInstance(), serviceIntent); to start my intent service. I am calling startForeground in service’s onHandleIntent after all my validations.

I have checked other questions with the same error. According to them I should be calling startForeground when the service starts, within 5 secs. My validations would take milliseconds as they are local. I am not sure what I am missing out here?

Should I call startForeground even before validations? But that doesnt make any sense.
According to this google group forum, it’s pending at google’s end?
https://issuetracker.google.com/issues/76112072#comment56

Note:The user’s are facing these crash randomly, though it crashes for them 2 out of 4 sessions

Foregroundservice using intentservice crash