相关疑难解决方法(0)

RemoteServiceException然后Context.startForegroundService()没有调用Service.startForeground()

在此输入图像描述

我在Android 8.0和Android 7.x中都通过Fabric.io收到了此错误报告.

因为它不仅仅是失败的特定类,我不知道如何处理它们.

如果您有任何想法,请帮助我.

android

9
推荐指数
1
解决办法
7857
查看次数

RemoteServiceException: Context.startForegroundService 然后没有调用 Service.startForeground

我从以下异常输出Device Monitor

//FATAL EXCEPTION: main
//Process: com.xxx.yyy, PID: 11584
//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:6944)
//    at java.lang.reflect.Method.invoke(Native Method)
//    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
//    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Run Code Online (Sandbox Code Playgroud)

我的应用程序中有 4 个服务,它们基本上都是这样的:

public class MyService extends Service {

    private static final int forgroundId = 55544433; //Unique for each Service
    private Notification notification;

    @Override
    public void onCreate() {
        super.onCreate();
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) { …
Run Code Online (Sandbox Code Playgroud)

service android android-notifications foregroundnotification

4
推荐指数
1
解决办法
2111
查看次数