Skip to content

[Bug]: java.util.ConcurrentModificationException on Android #2363

@rarenatoe

Description

@rarenatoe

Required Reading

  • Confirmed

Plugin Version

4.18.7

Mobile operating-system(s)

  • iOS
  • Android

Device Manufacturer(s) and Model(s)

SM-S908U1, SM-S918U, SM-S928U1, moto g - 2025

Device operating-systems(s)

Android 14, Android 15

React Native / Expo version

0.77, Expo 52

What happened?

I know there was a fix for this bug at 4.18.7, but my production build is currently giving this error regardless.

Roughly 5 out of 40 users are experiencing this issue.

Plugin Code and/or Config

import { Platform } from 'react-native'
import BackgroundGeolocation, { Config } from 'react-native-background-geolocation'

const STOP_TIMEOUT = 10
const DISTANCE_METERS = 150
const INTERVAL_MILLISECONDS = 15000

const geolocationSettings: Config = {
  desiredAccuracy:
    Platform.OS === 'ios'
      ? BackgroundGeolocation.DESIRED_ACCURACY_NAVIGATION
      : BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
  // Android only
  backgroundPermissionRationale: {
    title: `Allow {applicationName} to access this device's location in the background?`,
    message:
      'Swoop needs to use background location tracking to display truck locations on the map within the app. Swoop will only track your location when you are logged in to the app and on duty.',
  },
  distanceFilter: DISTANCE_METERS,
  disableElasticity: true,
  enableHeadless: true,
  fastestLocationUpdateInterval: INTERVAL_MILLISECONDS,
  foregroundService: true,
  notification: {
    title: 'Swoop',
    text: 'Tracking your location',
    smallIcon: 'ic_notification',
  },
  allowIdenticalLocations: true,

  // This will keep location services always on (this used to be true)
  disableStopDetection: false,
  // Stop on app terminate
  stopOnTerminate: false,
  // Restart tracking on phone restart
  startOnBoot: false,
  maxRecordsToPersist: 1,

  // This is the motion permission which will help battery life (used to be true)
  // We're disabling this for Android as it requires the ACTIVITY_RECOGNITION permission,
  // which has been removed due to conflicts with Google Play Store policies.
  disableMotionActivityUpdates: Platform.OS !== 'ios',

  /*
   * Without reset: true, the plugin will cache settings and ignore changes to them
   */
  reset: true,

  locationAuthorizationRequest: 'Always',
  // Activity Recognition
  stopTimeout: STOP_TIMEOUT,
  // Set true to sync multiple stored locations to server in a single HTTP request.
  batchSync: false,
  //  Set true to sync each location to server as it arrives.
  autoSync: true,

  url: '',
  httpRootProperty: '',
  locationTemplate: '',
  headers: {},
}

Relevant log output

Rollbar is reporting this as the error log:

.util.ConcurrentModificationException: <Unknown message> at 
com.swoopmobile.MainApplication.handleUncaughtException(Unknown Source:54) at 
com.swoopmobile.MainApplication.onCreate$lambda$0(Unknown Source:43) at 
com.swoopmobile.MainApplication.$r8$lambda$s6PvkmEnFg9JA6AEnrpWru6NMZo(Unknown Source:0) at 
n9.MainApplication$$ExternalSyntheticLambda0.uncaughtException(Unknown Source:2) at 
com.transistorsoft.locationmanager.adapter.BackgroundGeolocation$w0.uncaughtException(Unknown Source:98) at 
java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1071) at 
java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1066) at 
java.lang.Thread.dispatchUncaughtException(Thread.java:2306)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions