Skip to content

android.app.ForegroundServiceDidNotStartInTimeException - Context.startForegroundService() did not then call Service.startForeground() #230

@Ruttmann

Description

@Ruttmann

We're getting consistent reports of the message above with crashes of the app. Based on crashlytics reports, it happens when we teardown Radar listeners. That's the snippet of code we use for that:

Radar.off('error');
Radar.off('clientLocation');
Radar.stopTracking();

The whole exception message is:
android.app.ForegroundServiceDidNotStartInTimeException - Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{f2ad7fb u0 [omitted]/io.radar.sdk.RadarForegroundService}

Currently we use version 3.7.4, but this crash was also happening with version 3.4.1 (we updated the version a few days ago).

React Native version is 0.68.2

Our user base have Android devices that go from Android 8 to 12. This issue only happens on Android 12.

I researched this issue and noticed this seems to be an old bug ignored by Google. See this thread on Android Issue Tracker. Looking at react-native-radar lib, I couldn't find any calls to Context.startForegroundService(), so I'm confused.

We also have this issue thrown by an internal lib developed by our team, but there, I can see some calls to Context.startForegroundService().

Let me know if more info is needed. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions