Closed aakash1313 closed 4 years ago
Please log and see time diff between the two method calls to see if that's an issue.
On my own device I can get this exception if I try to use startForegroundService with the PullService. I don't get this with the LoggingService. But with the PullService I notice that the time between startForegroundService() and startForeground() is less than 5 seconds. And still this exception occurs. So requires more investigation...
@justinklchan , i tried this but didn't work . investigating it further
@justinklchan : By mistake it got closed , opening it again
@justinklchan : found the root cause for the issues. It seems we were logging the state of service incorrectly. Linked PR will resolve the issue completely. That part can be cleaned and refactored a bit. But that PR will resolve the issue for now
--------- beginning of crash 2020-04-18 01:22:08.927 12195-12195/edu.uw.covidsafe E/AndroidRuntime: FATAL EXCEPTION: main Process: edu.uw.covidsafe, PID: 12195 android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{17f93e5 u0 edu.uw.covidsafe/.LoggingService} at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1918) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:216) at android.app.ActivityThread.main(ActivityThread.java:7263) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)