tutanota icon indicating copy to clipboard operation
tutanota copied to clipboard

android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground()

Open charlag opened this issue 4 years ago • 1 comments

Some users complain that the system notification does not go away for minutes. Logs suggest that the problem is in this stacktrace:

-26 04:33:18.657 16099 16099 E AndroidRuntime: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground()
11-26 04:33:18.657 16099 16099 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1881)
11-26 04:33:18.657 16099 16099 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:105)
11-26 04:33:18.657 16099 16099 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:164)
11-26 04:33:18.657 16099 16099 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:6944)
11-26 04:33:18.657 16099 16099 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
11-26 04:33:18.657 16099 16099 E AndroidRuntime: 	at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
11-26 04:33:18.657 16099 16099 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

Except that we do call startForegroundService() but only in onCreate(). My guess is that we stopForeground() at some point and than we don't start it again when we get another start command. We should probably do startForeground() each time in the start

charlag avatar Dec 02 '19 08:12 charlag

Note: This is currently responsible for 90% of our Crashes and App-not-responding on google play.

E: It's now at 94%

ganthern avatar Aug 15 '22 15:08 ganthern