Skip to content

ForegroundServiceDidNotStartInTimeException #178

@hpsaturn

Description

@hpsaturn

Summary

In some phones, like Pixel6 we have a reported issue from CrashLytics:

android.app.RemoteServiceException$ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{abb6b47 u0 hpsaturn.pollutionreporter/.service.RecordTrackService c:hpsaturn.pollutionreporter}
                                                                                                    	at android.app.ActivityThread.generateForegroundServiceDidNotStartInTimeException(ActivityThread.java:2298)
                                                                                                    	at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:2266)
                                                                                                    	at android.app.ActivityThread.-$$Nest$mthrowRemoteServiceException(Unknown Source:0)
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2640)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:109)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:232)
                                                                                                    	at android.os.Looper.loop(Looper.java:317)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:8787)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:871)
                                                                                                    Caused by: android.app.StackTrace: Last startServiceCommon() call for this service was made here
                                                                                                    	at android.app.ContextImpl.startServiceCommon(ContextImpl.java:2033)
                                                                                                    	at android.app.ContextImpl.startForegroundService(ContextImpl.java:1987)
                                                                                                    	at android.content.ContextWrapper.startForegroundService(ContextWrapper.java:853)
                                                                                                    	at android.content.ContextWrapper.startForegroundService(ContextWrapper.java:853)
                                                                                                    	at hpsaturn.pollutionreporter.MainActivity.startRecordTrackService(MainActivity.java:417)
                                                                                                    	at hpsaturn.pollutionreporter.MainActivity.onCreate(MainActivity.java:110)
                                                                                                    	at android.app.Activity.performCreate(Activity.java:9019)
                                                                                                    	at android.app.Activity.performCreate(Activity.java:8997)
                                                                                                    	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1528)
                                                                                                    	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4111)
                                                                                                    	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4316)
                                                                                                    	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80)
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2719)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:109at android.os.Looper.loopOnce(Looper.java:232at android.os.Looper.loop(Looper.java:317at android.app.ActivityThread.main(ActivityThread.java:8787at java.lang.reflect.Method.invoke(Native Methodat com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:871

it happens also when the RecordTrackReceiver with the scheduler

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions