-
Notifications
You must be signed in to change notification settings - Fork 281
[Bug]: IllegalStateException: FragmentManager has been destroyed #1658
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Required Reading
- Confirmed
Plugin Version
5.0.5
Flutter Doctor
[✓] Flutter (Channel stable, 3.41.2, on macOS 26.3.1 25D2128 darwin-arm64, locale en-IL)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 26.3)
[✓] Chrome - develop for the web
[✓] Connected device (3 available)
[✓] Network resources
• No issues found!Mobile operating-system(s)
- iOS
- Android
Device Manufacturer(s) and Model(s)
Samsung Galaxy S25 Ultra (SM-S938B), Samsung Galaxy S26 Ultra (SM-S948B), Samsung Galaxy A55 5G (SM-A556E)
Device operating-systems(s)
Android 15, Android 16
What happened?
The following issue has been appearing in our Sentry issues since releasing v5 of the plugin.
The listed devices are the top 3 affected - more are affected, but seems to be only Samsung devices.
I'm unable to reproduce myself.
Attaching some seemingly relevant breadcrumbs.
Any help or suggestions?
| Timestamp | Type | Category | Level | Message | Data |
|---|---|---|---|---|---|
| 2026-03-17T20:55:41.962Z | navigation | app.lifecycle | info | {"state":"foreground"} | |
| ... | |||||
| 2026-03-17T20:55:42.584Z | default | LocationUtils | info | [LOC UTILS] >>> starting bg <<< | |
| 2026-03-17T20:55:42.593Z | default | LocationUtils | info | [LOC UTILS] >>> INITIALIZED <<< | |
| ... | |||||
| 2026-03-17T20:55:42.842Z | navigation | ui.lifecycle | info | {"screen":"MainActivity","state":"paused"} | |
| 2026-03-17T20:55:42.848Z | navigation | ui.lifecycle | info | {"screen":"TSLocationManagerActivity","state":"created"} | |
| 2026-03-17T20:55:42.849Z | navigation | ui.lifecycle | info | {"screen":"TSLocationManagerActivity","state":"started"} | |
| 2026-03-17T20:55:42.850Z | navigation | ui.lifecycle | info | {"screen":"TSLocationManagerActivity","state":"resumed"} | |
| 2026-03-17T20:55:42.874Z | navigation | ui.lifecycle | info | {"screen":"TSLocationManagerActivity","state":"paused"} | |
| ... | |||||
| 2026-03-17T20:55:44.964Z | navigation | ui.lifecycle | info | {"screen":"MainActivity","state":"resumed"} | |
| 2026-03-17T20:55:44.983Z | navigation | ui.lifecycle | info | {"screen":"TSLocationManagerActivity","state":"stopped"} | |
| 2026-03-17T20:55:44.984Z | navigation | ui.lifecycle | info | {"screen":"TSLocationManagerActivity","state":"destroyed"} | |
| 2026-03-17T20:55:45.064Z | error | exception | error | {"type":"IllegalStateException","value":"FragmentManager has been destroyed"} |
Plugin Code and/or Config
// --------------------------------
// Configure the plugin
// --------------------------------
bg.State state = await bg.BackgroundGeolocation.ready(
_getBGConfig(locAuthAlways: forceAlwaysLocPerm),
);
if (!state.enabled) {
log.info('[LOC UTILS] >>> starting bg <<<');
// --------------------------------
// Start the plugin
// --------------------------------
state = await bg.BackgroundGeolocation.start();
}
..
bg.Config(
geolocation: bg.GeoConfig(
desiredAccuracy: bg.DesiredAccuracy.high,
distanceFilter: 10.0,
locationAuthorizationRequest: locAuthAlways ? 'Always' : 'WhenInUse',
locationAuthorizationAlert: {
'titleWhenNotEnabled': t('Location Services not enabled'),
'titleWhenOff': t('Location Services are OFF'),
'instructions': tf(t("You must enable <> in location services"), 'Always'),
'cancelButton': t('Cancel'),
'settingsButton': t('Settings'),
},
),
app: bg.AppConfig(
backgroundPermissionRationale: bg.PermissionRationale(
title: t('Allow {applicationName} to access to this device\'s location in the background?'),
message: t(
'In order to track your activity in the background, please enable {backgroundPermissionOptionLabel} location permission',
),
positiveAction: t("Change to {backgroundPermissionOptionLabel}"),
negativeAction: t("Cancel"),
),
heartbeatInterval: 60.0,
),
http: bg.HttpConfig(
autoSync: false,
),
persistence: bg.PersistenceConfig(
persistMode: bg.PersistMode.none,
maxRecordsToPersist: 1000,
),
logger: bg.LoggerConfig(
logMaxDays: 0,
logLevel: kDebugMode ? bg.LogLevel.verbose : bg.LogLevel.warning,
),
)Relevant log output
java.lang.IllegalStateException: FragmentManager has been destroyed
at androidx.fragment.app.k0.y(FragmentManager.java:17)
at androidx.fragment.app.k0.A(FragmentManager.java:12)
at com.transistorsoft.locationmanager.a.y.a(r8-map-id-667cd95e1628b15681813d00ea1da26fefad30d662bdeaba1c7c6b82393c6089:10)
at com.transistorsoft.locationmanager.a.b.<init>(r8-map-id-667cd95e1628b15681813d00ea1da26fefad30d662bdeaba1c7c6b82393c6089:4)
at com.transistorsoft.locationmanager.a.x.a(r8-map-id-667cd95e1628b15681813d00ea1da26fefad30d662bdeaba1c7c6b82393c6089:3)
at com.transistorsoft.locationmanager.a.z.b(r8-map-id-667cd95e1628b15681813d00ea1da26fefad30d662bdeaba1c7c6b82393c6089:13)
at androidx.fragment.app.q.run(R8$$SyntheticClass:62)
at android.os.Handler.handleCallback(Handler.java:959)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loopOnce(Looper.java:257)
at android.os.Looper.loop(Looper.java:342)
at android.app.ActivityThread.main(ActivityThread.java:9579)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:619)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:929)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working