react-native-background-geolocation: Crash after terminate (Android)
Environment
- Plugin version: 3.0.2
- Platform: Android
- OS version: 6.0
- Device manufacturer / model: LG / K10
- React Native version: 0.59.5
- Plugin config
{
reset: true,
enableHeadless: true,
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
stopOnTerminate: false,
startOnBoot: true,
isMoving: true,
foregroundService: true,
heartbeatInterval: 60,
preventSuspend: true,
}
Expected Behavior
Should work even app is terminated.
Actual Behavior
When the application is terminated an alert is shown “Unfortunately, app has stopped”
Context
Trying to collect location data after application is terminated.
Debug logs
05-06 22:31:56.270 4542-4592/com.example E/ReactNativeJS: No task registered for key BackgroundGeolocation
05-06 22:31:56.371 4542-4542/com.example E/unknown:ReactNative: Unable to launch redbox because react activity is not available, here is the error that redbox would've displayed: No task registered for key BackgroundGeolocation
05-06 22:31:56.375 4542-4542/com.example E/unknown:ReactNative: Unable to launch redbox because react activity is not available, here is the error that redbox would've displayed: No task registered for key BackgroundGeolocation
05-06 22:31:56.380 4542-4542/com.example E/unknown:ReactNative: Unable to launch redbox because react activity is not available, here is the error that redbox would've displayed: No task registered for key BackgroundGeolocation
05-06 22:32:25.591 4542-4542/com.example E/TSLocationManager: [c.t.l.l.TSLocationManager getLastLocation]
‼️ Failed to get last location: com.google.android.gms.tasks.zzu@1d63ac9
05-06 22:32:25.701 4542-4542/com.example E/EventBus: Could not dispatch event: class com.transistorsoft.locationmanager.event.HeadlessEvent to subscribing class class com.transistorsoft.rnbackgroundgeolocation.HeadlessTask
java.lang.ClassCastException: com.transistorsoft.locationmanager.service.HeartbeatService cannot be cast to com.facebook.react.ReactApplication
at com.transistorsoft.rnbackgroundgeolocation.HeadlessTask.startTask(HeadlessTask.java:109)
at com.transistorsoft.rnbackgroundgeolocation.HeadlessTask.onHeadlessEvent(HeadlessTask.java:95)
at java.lang.reflect.Method.invoke(Native Method)
at org.greenrobot.eventbus.EventBus.invokeSubscriber(EventBus.java:485)
at org.greenrobot.eventbus.EventBus.postToSubscription(EventBus.java:420)
at org.greenrobot.eventbus.EventBus.postSingleEventForEventType(EventBus.java:397)
at org.greenrobot.eventbus.EventBus.postSingleEvent(EventBus.java:370)
at org.greenrobot.eventbus.EventBus.post(EventBus.java:251)
at com.transistorsoft.locationmanager.util.a.a(Unknown Source)
at com.transistorsoft.locationmanager.service.HeartbeatService.onStartCommand(Unknown Source)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3028)
at android.app.ActivityThread.access$2200(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1454)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5530)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:734)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (9 by maintainers)
3.0.3 isn’t tagged though, so I can’t easily reference it - I don’t want to put master in my package.json or I can’t reproduce builds… I can reference it by the commit hash though 681a8c37c249244ed33597420c61c565392de798 but the checkout on those is for some reason terribly slow