react-native-background-geolocation: rnmapbox user location stops working when react-native-background-geolocation is added to the project
Your Environment
- Plugin version: 4.13.2
- Platform: Android
- OS version: 10
- Device manufacturer / model: Samsung Galaxy A10
- React Native version (
react-native -v): 0.72.4 - Plugin config I’ve just imported the library as in this example
import React from 'react';
import MapboxGL, {Camera, MapView} from '@rnmapbox/maps';
import BackgroundGeolocation from 'react-native-background-geolocation-android';
import {Platform} from 'react-native';
MapboxGL.setWellKnownTileServer(Platform.OS === 'ios' ? 'mapbox' : 'Mapbox');
MapboxGL.setAccessToken('your token');
const mapViewStyle = {
flex: 1,
};
const App = () => {
const mapRef = React.useRef<MapboxGL.MapView>(null);
return (
<>
<MapView style={mapViewStyle} ref={mapRef}>
<Camera
zoomLevel={8}
followUserLocation={true}
followUserMode={'normal'}
followZoomLevel={14}
/>
<MapboxGL.UserLocation visible={true} showsUserHeadingIndicator />
</MapView>
</>
);
};
Expected Behavior
The user location should reflect the phone’s location as when react-native-background-geolocation is not added to the project.
Actual Behavior
Started the example app above on an Android phone and walked 300m after 300m the user location was still at the starting point.
Steps to Reproduce
- Start example app
- Walk for a bit
- Check if the user location is in your location
Context
We are working on an app where we use rnmapbox to show a map to the user with the current location and react-native-background-geolocation to track the user’s location while in the background.
Just to be clear the issue is not that react-native-background-geolocation is not reporting location updates.
The problem is when react-native-background-geolocation is added to the example app, mapbox stops getting location
updates.
Debug logs
Logs
2023-09-04 13:20:23.758 28564-28696/com.mymapproject E/TSLocationManager: ╔═════════════════════════════════════════════
║ LICENSE VALIDATION FAILURE: com.mymapproject
╠═════════════════════════════════════════════
╟─ Invalid license key: ***
╟─ BackgroundGeolocation is fully functional in DEBUG builds without a license.
╚═════════════════════════════════════════════
2023-09-04 13:20:23.960 28564-28727/com.mymapproject D/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] PID: 2
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Comments: 15 (8 by maintainers)
What do you expect me to do with this? I don’t use MapBox.
if you want me to test something; point me to a GitHub repo to clone and run.