Context.startForegroundService() did not then call

2020-06-15 05:15发布

问题:

I have an issue with background working of service on Samsung devices.

Fatal Exception: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground()
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1881)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6938)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

Of course, after starting the service I call Service.startForeground() and there are no problems on other devices just only Samsung device.

Is anybody know the reason and how to work around of this issue?

I have found similar problem in Zopim SDK https://chat.zendesk.com/hc/en-us/community/posts/360004395368-Crash-on-Android-8-in-Android-SDK-1-4-2

回答1:

Fixed in 1.4.4

Fixed a bug in the ChatWidgetService lifecycle handling that caused RemoteServiceException.

https://developer.zendesk.com/embeddables/docs/android-chat-sdk/releasenotes#version-1.4.4