- SDK Version: 4.7.3
- Platforms(Android/iOS/web/all): React Native (so far just Android)
- Add the appropriate “Tag” based on what Expo library you have a question on.
I’m developing a sports app with React Native / Expo which needs to track user background when the app is in the background.
This is related to my previous question (React Native expo-location: How to make the background location service update more often?). I came to the conclusion that the background location tracking in the ‘expo-location’ package does not seem to sufficiently work, so I started building a new solution based on the package ‘@mauron85/react-native-background-geolocation’ which I found was recommended in several tutorials.
So I installed the module and built my map component based on the example code provided in the documentation (GitHub - mauron85/react-native-background-geolocation: Background and foreground geolocation plugin for React Native. Tracks user when app is running in background.).
However, when running the app on Expo Go, I get the following error message despite doing all the required imports:
Component Exception: RNBackgroundGeolocation is undefined
This appears to be caused by a problem in linking modules, which I failed to do during the installation. The component requires to do linking of modules with the following command:
node ./node_modules/@mauron85/react-native-background-geolocation/scripts/postlink.js
Because I use Expo managed workflow, I lack the folder structure (./android/settings.gradle etc) required by this script and receive an error of ‘android/settings.gradle not found’. Based on some searching, this seems to require running ‘expo eject’ on the whole project so that I can do configurations in the platform-specific folders.
However, ‘expo eject’ runs into errors in the “Installing JavaScript dependencies” phase and just returns an error of “Something went wrong … …”, and the error logs provide no further clarification.
Questions:
- How to get forward when something goes wrong in the ‘expo eject’ phase like this? The error logs get really messy and unclear.
- I would really prefer to stay in the managed workflow to avoid any mess. Is there a way to get the modules linking work within the Expo managed workflow?
Any help appreciated, thanks.