react-native-background-geolocation: Illegal callback invocation from native module. This callback type only permits a single invocation from native code

Your Environment

  • Plugin version: 3.2.2, 3.3.2
  • Platform: Android
  • OS version: 8, 9
  • Device manufacturer / model: OnePlus 6, Samsung S9+,Moto Z (2) Play, Galaxy S7 Edge, Honor 8X and other.
  • React Native version (react-native -v): 0.59.10
  • Plugin config
        desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
        distanceFilter: 75,
        stopOnStationary: false,
        useSignificantChangesOnly: false,
        foregroundService: true,
        allowIdenticalLocations: false,
        stopOnTerminate: true,
        startOnBoot: false,
        preventSuspend: true,
        autoSync: false,
        disableMotionActivityUpdates: false,
        stopOnStillActivity: false,
        disableStopDetection: true,
        pausesLocationUpdatesAutomatically: false,
        heartbeatInterval: 60,
        reset: true,
        debug: false,
        logLevel: BackgroundGeolocation.LOG_LEVEL_ERROR

Expected Behavior

No exception thrown and app crashed

Actual Behavior

Following exception thrown:

Fatal Exception: java.lang.RuntimeException: Illegal callback invocation from native module. This callback type only permits a single invocation from native code. at com.facebook.react.bridge.CallbackImpl.invoke(CallbackImpl.java:23) at com.transistorsoft.rnbackgroundgeolocation.RNBackgroundGeolocationModule$12.onLocation(RNBackgroundGeolocationModule.java:16) at com.transistorsoft.locationmanager.location.TSLocationManager$c$1.run(TSLocationManager.java:12) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6898) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Steps to Reproduce

No steps to reproduce, the crash happened on remote phone device

Context

Capture user’s location via geolocation plugin

Debug logs

Logs
PASTE_YOUR_LOGS_HERE

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 21 (10 by maintainers)

Most upvoted comments

Hi Chris!

Facing the same issue after updating to version 3.4.2. We register onLocation in componentDidMount https://gist.github.com/losnikitos/9105f037cddf3c23e0ea2310a3f11989#file-geolocation-js-L31.

It’s been around for a while, but skyrocketed with newest plugin version 2019-12-23_15-13-12

Stacktrace
Fatal Exception: java.lang.RuntimeException: Illegal callback invocation from native module. This callback type only permits a single invocation from native code.
       at com.facebook.react.bridge.CallbackImpl.invoke + 28(CallbackImpl.java:28)
       at com.transistorsoft.rnbackgroundgeolocation.RNBackgroundGeolocationModule$12.onLocation + 553(RNBackgroundGeolocationModule.java:553)
       at com.transistorsoft.locationmanager.location.TSLocationManager$2.run + 16(:16)
       at android.os.Handler.handleCallback + 790(Handler.java:790)
       at android.os.Handler.dispatchMessage + 99(Handler.java:99)
       at android.os.Looper.loop + 164(Looper.java:164)
       at android.app.ActivityThread.main + 6518(ActivityThread.java:6518)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run + 438(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main + 807(ZygoteInit.java:807)

I’m not seeing or hearing of a problem.