react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

java.lang.IllegalArgumentException: Receiver not registered: com.transistorsoft.locationmanager.device

Open mluu510 opened this issue 6 years ago • 16 comments

Your Environment

  • Plugin version: 3.0.7
  • Platform: Android
  • OS version: 8.0
  • Device manufacturer / model: Samsung devices
  • React Native version (react-native -v): 0.59.10
  • Plugin config
java.lang.IllegalArgumentException: Receiver not registered: com.transistorsoft.locationmanager.device.a$a@30ad369
1
at com.swoopmobile.MainApplication.a ([unknown]:4)
2
at com.swoopmobile.MainApplication$2.uncaughtException ([unknown]:2)
3
at com.pushwoosh.internal.crash.g.uncaughtException ([unknown]:107)
4
at com.transistorsoft.locationmanager.adapter.BackgroundGeolocation$e.uncaughtException ([unknown]:108)
5
at java.lang.ThreadGroup.uncaughtException (ThreadGroup.java:1073)
6
at java.lang.ThreadGroup.uncaughtException (ThreadGroup.java:1068)
7
at java.lang.Thread.dispatchUncaughtException (Thread.java:2187)


config settings: {
  desiredAccuracy: Platform.OS === 'ios' ? BackgroundGeolocation.DESIRED_ACCURACY_NAVIGATION : BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
  // Android only
  distanceFilter: 150,
  fastestLocationUpdateInterval: 15000,
  foregroundService: true,
  notificationTitle: 'Swoop',
  notificationText: 'Tracking your location',
  allowIdenticalLocations: true,

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

  // Ios only
  // This is the motion permission which will help battery life (used to be true)
  disableMotionActivityUpdates: false,

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

  locationAuthorizationRequest: 'Always',
  // Activity Recognition
  stopTimeout: 1,
  // Application config, beeps when location succeess or fails
  // debug: false,  // __DEV__ && Config.GEOLOCATION_DEBUG === 'true',
  // debug: true,
  logLevel:
    __DEV__ && Config.GEOLOCATION_DEBUG === 'true' ?
      BackgroundGeolocation.LOG_LEVEL_VERBOSE :
      BackgroundGeolocation.OFF,

  // 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,
  // Don't send server side updates inside the geolocation component
  url: null,
}

Expected Behavior

error not to happen

Actual Behavior

Our bug tracker; Rollbar, is reporting lots of these errors from our users.

Steps to Reproduce

Cannot repo in person but can see it in Rollbar bug tracker

Context

Is this caused by stopOnTerminate: true? how can we make this work with that setting enabled?

Debug logs

Logs
PASTE_YOUR_LOGS_HERE

mluu510 avatar Dec 31 '19 00:12 mluu510

You're using an early v3 version from 6 months ago. Upgrade to latest 3.4.2

christocracy avatar Dec 31 '19 00:12 christocracy

hey chris,

we updated our library to the latest; 3.4.2 and still getting a similar bug:

java.lang.IllegalArgumentException: NetworkCallback was already unregistered (Most recent call first) at com.swoopmobile.MainApplication.a ([unknown]:4) at com.swoopmobile.MainApplication$2.uncaughtException ([unknown]:2) at com.pushwoosh.internal.crash.g.uncaughtException ([unknown]:107) at com.transistorsoft.locationmanager.adapter.BackgroundGeolocation$e.uncaughtException ([unknown]:108)

how do we resolve this?

mluu510 avatar Jan 13 '20 23:01 mluu510

Are you building for debug or release?

christocracy avatar Jan 13 '20 23:01 christocracy

release

mluu510 avatar Jan 14 '20 17:01 mluu510

Did you purchase a license?

christocracy avatar Jan 14 '20 17:01 christocracy

yes, we did. our app is Swoop Towing

mluu510 avatar Jan 15 '20 00:01 mluu510

Do you have minifyEnabled true In your app/build.gradle?

christocracy avatar Jan 15 '20 00:01 christocracy

yes, we have minifyEnabled for debug and release

mluu510 avatar Jan 16 '20 00:01 mluu510

And did you perform the required step about proguard-rules in the Android Setup documentation when using minifyEnabled?

christocracy avatar Jan 16 '20 00:01 christocracy

i've added the proguard rule and that seem to have fixed our receiver not registered issue. but, we are still receiving a lot of this error:

java.lang.IllegalArgumentException: NetworkCallback was already unregistered (Most recent call first)
at com.swoopmobile.MainApplication.a ([unknown]:4)
at com.swoopmobile.MainApplication$2.uncaughtException ([unknown]:2)
at com.pushwoosh.internal.crash.g.uncaughtException ([unknown]:107)
at com.transistorsoft.locationmanager.adapter.BackgroundGeolocation$e.uncaughtException ([unknown]:108)

is there anything we can do to fix this bug?

mluu510 avatar Feb 06 '20 00:02 mluu510

The plugin has an uncaughtException handler for all errors in your app. I don’t see enough of a stacktrace to implicate the plugin is responsible here.

christocracy avatar Feb 06 '20 00:02 christocracy

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.

stale[bot] avatar Apr 06 '20 01:04 stale[bot]

Closing this issue after a prolonged period of inactivity. Fell free to reopen this issue, if this still affecting you.

stale[bot] avatar Apr 13 '20 03:04 stale[bot]

Hey @christocracy we are still receiving a lot of this error. any solution for this?

java.lang.IllegalArgumentException: NetworkCallback was already unregistered (Most recent call first)
at com.swoopmobile.MainApplication.a ([unknown]:4)
at com.swoopmobile.d.uncaughtException ([unknown]:2)
at com.pushwoosh.internal.crash.g.uncaughtException ([unknown]:105)
at com.transistorsoft.locationmanager.adapter.BackgroundGeolocation$e.uncaughtException ([unknown]:106)

mathankumarinspirisys avatar Nov 12 '20 12:11 mathankumarinspirisys

@christocracy we are seeing this pop up at our end too. I see this one is a bit older but any thoughts what might be a cause?

Your Environment

  • Plugin version: 4.9.3

  • Platform: Android

  • OS version: 12

  • Device manufacturer / model: Samsung; models: Galaxy Xcover 5, Galaxy A12

  • React Native version (react-native -v): 0.70.4

  • Plugin config

{
      foregroundService: true,
      desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
      distanceFilter,
      activityType: BackgroundGeolocation.ACTIVITY_TYPE_OTHER_NAVIGATION,
      allowIdenticalLocations: true,
      disableMotionActivityUpdates: true,
      disableStopDetection: true,
      stopOnTerminate: false,
      pausesLocationUpdatesAutomatically: false,
      stopOnStationary: true,
      stopTimeout: 5,
      locationUpdateInterval: 30000,
      debug: false,
      logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
      startOnBoot: false,
      httpRootProperty: '.',
      batchSync: false,
      autoSync: true,
      locationTemplate: '{}',
      locationAuthorizationRequest: 'Always',
      locationAuthorizationAlert: {
        titleWhenNotEnabled: 'Location Services not enabled',
        titleWhenOff: 'Location Services turned off',
        instructions: "You must enable 'Always' in location Services",
        cancelButton: 'Cancel',
        settingsButton: 'Settings',
      },
      backgroundPermissionRationale: {
        title: "Allow {applicationName} to access to this device's location in the background?",
        message:
          'In order to track your activity in the background, please enable {backgroundPermissionOptionLabel} location permission',
        positiveAction: 'Change to {backgroundPermissionOptionLabel}',
        negativeAction: 'Cancel',
      },
      maxRecordsToPersist: 1,
    }
Fatal Exception: java.lang.IllegalArgumentException: NetworkCallback was already unregistered
       at com.android.internal.util.Preconditions.checkArgument(Preconditions.java:47)
       at android.net.ConnectivityManager.unregisterNetworkCallback(ConnectivityManager.java:3886)
       at com.transistorsoft.locationmanager.http.HttpService.stopMonitoringConnectivityChanges(:38)
       at com.transistorsoft.locationmanager.service.TrackingService.stop(:119)
       at com.transistorsoft.locationmanager.adapter.BackgroundGeolocation.c(:2)
       at com.transistorsoft.locationmanager.adapter.BackgroundGeolocation.$r8$lambda$oSDeWXxQl1jmikdjYQwff60damw()
       at com.transistorsoft.locationmanager.adapter.BackgroundGeolocation$$ExternalSyntheticLambda0.run(:4)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:764)

cedricjacobs avatar Nov 30 '22 22:11 cedricjacobs

I will add code to catch and ignore this innocuous Exception. It will be noted in the CHANGELOG of the next release.

christocracy avatar Dec 01 '22 15:12 christocracy