Closed jones139 closed 11 months ago
The startForeground method has to be called within 5 seconds of creating the service. At the moment we do this (along with creating the notification) at the end of onStartCommand in SdServer. If there is a delay in one of the server initialisation routines, it could cause this crash. Have tried moving the notification display and call to startForeground() to onCreate() instead so it is called very soon after the service is created.
User reported crash when enabling NDA logging in settings:
** UCE HANDLER Library *** by Rohit Surwase
***** DEVICE INFO Brand: OnePlus Device: Nord Model: AC2003 Manufacturer: OnePlus Product: Nord_EEA SDK: 30 Release: 11
***** APP INFO Version: 4.1.8 Installed On: 2022-04-17 21:52:31 Updated On: 2023-06-18 08:11:27 Current Date: 2023-06-18 08:14:45
***** ERROR LOG android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{707bd75 u0 uk.org.openseizuredetector/.SdServer} at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2192) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:245) at android.app.ActivityThread.main(ActivityThread.java:8024) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
END OF LOG