react-native-background-geolocation: Android 8 crashes when location is turned off on the phone
Your Environment
- Plugin version: 2.11.0, 2.12.0
- Platform: Android
- OS version: 8+
- Device manufacturer / model:
- React Native version (
react-native -v
): 0.51, 0.54 - Plugin config: Default
Expected Behavior
Location listener should get an error or providerchange listener should say that location services are turned off
Actual Behavior
App crashes
Steps to Reproduce
- Turn location services off (app has permission to use location)
- Navigate to a view where BackgroundGeolocation.start() is called
- App crashes
Context
I’m sorry if it has nothing to do with this library, but since it only occurs when the location services have a specific state, I’m posting it here just in case. An issue with the same error message has been posted to the Android issue tracker as well: https://issuetracker.google.com/issues/76112072
Debug logs
04-03 08:30:19.624 20380-20380/com.begin E/AndroidRuntime: FATAL EXCEPTION: main Process: com.begin, PID: 20380 android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground() at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1775) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6541) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 18 (9 by maintainers)
That was the case, thanks