Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App is crashing - NullPointerException com.transistorsoft.locationmanager.geofence.TSGeofenceManager in startMonitoringPolygone #2157

Open
jakub-oone opened this issue Sep 30, 2024 · 3 comments

Comments

@jakub-oone
Copy link

Hello Chris,

we got the error "Attempt to invoke virtual method 'java.lang.String com.transistorsoft.locationmanager.geofence.TSGeofence.getIdentifier()' on a null object reference"

Stack trace:
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.transistorsoft.locationmanager.geofence.TSGeofence.getIdentifier()' on a null object reference

at com.transistorsoft.locationmanager.geofence.TSGeofenceManager.startMonitoringPolygon
at com.transistorsoft.locationmanager.geofence.TSGeofenceManager.start
at com.transistorsoft.locationmanager.service.TrackingService.start
at com.transistorsoft.locationmanager.adapter.BackgroundGeolocation$z0.run
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)

We have tried to investigate this issue on our end. We tried to add corrupted/invalid/empty/undefined/null... geofences in BackgroundGeolocation.addGeofences method, but we were not able to reproduce this error in debug build.

Could you please look at this in the native code? We would really appreciate it. Or what do you suggest to do on our end? Do you have some idea?

Your Environment

  • Plugin version: 4.17.1
  • Platform: Android
  • OS version: Android 11 and 14
  • Device manufacturer / model: Pixel 7a (AP2A.240905.003)
  • React Native version (react-native -v): 0.73.7
  • Plugin config
const state:State = await BackgroundGeolocation.ready({
     desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_MEDIUM,
    distanceFilter: 20,
    reset: true,
    debug: false,
    stopOnTerminate: false,
    stopOnStationary: false,
    startOnBoot: true,
    enableHeadless: true,
    maxDaysToPersist: 2,
    geofenceProximityRadius: 50000,
    geofenceInitialTriggerEntry: true,
    preventSuspend: true,
    disableLocationAuthorizationAlert: true,
    locationAuthorizationRequest: 'Always',
    useSignificantChangesOnly: false,
    geofenceModeHighAccuracy: false,
    logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
    });

Expected Behavior

App is not crashing after startMonitoringPolygone is called

Actual Behavior

App is crashing on some devices after startMonitoringPolygone is called

Steps to Reproduce

  1. Add some valid geofences to BackgroundGeolocation.addGeofences(geofences)
  2. Start monitore polygone
  3. App crash

Context

We have tried to investigate this issue on our end. We tried to add corrupted/invalid/empty/undefined/null... geofences in BackgroundGeolocation.addGeofences method, but we were not able to reproduce this error in debug build.
Our geofences look like this:

{
   identifier: `tour_${activeTourRouteInterface.id}`,
   notifyOnEntry: true,
   notifyOnExit: true,
   notifyOnDwell: true,
   vertices: [
     [50.064842285635024, 14.411941808263784],
     [50.06480937893958, 14.41194482235038],
     [50.064721379239934, 14.411954828724795],
     [50.064551304826175, 14.41198433993442],
   ],
   extras: {
      kind: TOUR_GEOFENCE,
      id: activeTourRouteInterface.id,
   },
}

Debug logs

Logs
PASTE_YOUR_LOGS_HERE
@christocracy
Copy link
Member

It seems that a Geofence has been removed from the database but the plugin still contains a reference to its identifier in a list of monitoredPolygons.

I will add a null check for this case.

@jakub-oone
Copy link
Author

Perfect, when can we expect that update with fix? We had to halt the release.
Thank you!

@christocracy
Copy link
Member

v4.17.2 is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants